Array Problem, sort Array

On Behalf Of [email protected]
#But it’s a question of whether <=> is defined or not, so C.new is in
#exactly the same position as nil. So the question is: if [C.new]
#(one-element array) “sorts”, why should [nil] not “sort”?

yes, single elements do return regardless. i was used to thinking
nil-filled arrays wont sort directly. pls forgive my noise.

in general,
[anyobject].sort always return [anyobject]
but
[anyobject,anyobject].sort may or may not be defined (unless filtered
by block)

thanks to everyone for the enlightenment.
kind regards -botp

ps: this may be for a new thread, and i should have asked this a long
time ago, but: why no <=> op for nil? so [nil, nil, nil].sort => [nil,
nil, nil]

When i found a shoppyng under ruby?

2007/6/28, [email protected] [email protected]:

From: F. Senault [mailto:[email protected]] :

and only one object ; the nature of this object doesn’t enter into the

equation. You just don’t need to perform any comparisons to sort an

array of one element… or zero :

indeed, thanks senault for the enlightenment. i was used to thinking
that if my sorting routines passes, then i don’t have nil objects in
them. i totally missed the sorting algorithm for just one and only one
element.
see my previous msg to david too.
kind regards -botp