>>>>> "JG" == Joe Gottman <[EMAIL PROTECTED]> writes:


  JG>    How do you decide whether a key-extractor block returns number?  Do you
  JG> look at the signature,  or do you simply evaluate the result of the
  JG> key-extractor for each element in the unsorted list?  For example, what is
  JG> the result of the following code?

  JG>       sort {$_.key} (1=> 'a', 10 => 'b', 2 =>'c');

  JG>    There is nothing in the signature of the key-extractor to suggest that
  JG> all the keys are numbers, but as it turns out they all are.  Will the sort
  JG> end up being numerical or alphabetic?

my take is that either <=> or cmp (my pref) would be the default
comparator. if you want to force one, you need to use prefix ~ or + or
int.

oh, another reason to make cmp the default is BACKWARDS COMPATIBILITY!
we have support now for the old simple @sorted = sort @unsorted syntax
so the cmp should still be the default.

hey, i am remembering p6 syntax now! but give me a week and i will
forget it again :)

uri

-- 
Uri Guttman  ------  [EMAIL PROTECTED]  -------- http://www.stemsystems.com
--Perl Consulting, Stem Development, Systems Architecture, Design and Coding-
Search or Offer Perl Jobs  ----------------------------  http://jobs.perl.org

Reply via email to