Re: The Sort Problem: a definitive ruling

2004-02-20 Thread Damian Conway
Smylers wrote: Oh. I'd been assuming that quote marks indicated strings, and that, while a string containing only digits could obviously be treated as a number (as in Perl 5), it wouldn't be one without being provoked. Correct. What about: $x = '0345'; Is that a number? Nope. A string (un

Re: The Sort Problem: a definitive ruling

2004-02-20 Thread Damian Conway
Luke wrote: I think you're forgetting what language you're talking about. Those are numbers. After this statement: $x = '345'; C<$x> is a number. I don't think so. C<$x> is, of course, a variable. And what it contains after that statement will depend on whether the variable is explicitly

Re: The Sort Problem: a definitive ruling

2004-02-20 Thread Damian Conway
Smylers wrote: sort {$_.key} (1=> 'a', 10 => 'b', 2 =>'c'); There is nothing in the signature of the key-extractor to suggest that all the keys are numbers, but as it turns out they all are. Are they? I'd been presuming that pair keys would always be strings Nope. > and that the C<< => >>

Re: The Sort Problem: a definitive ruling

2004-02-20 Thread Damian Conway
Uri wondered: DC> No. C<< &infix:<=> >> is the name of the binary C<< <=> >> operator. so how is that allowed there without a block? A Code object in a scalar context yields a Code reference. Damian

Re: The Sort Problem: a definitive ruling

2004-02-20 Thread Damian Conway
Joe Gottman asked: How do you decide whether a key-extractor block returns number? Do you look at the signature, or do you simply evaluate the result of the key-extractor for each element in the unsorted list? For example, what is the result of the following code? sort {$_.key} (1=> 'a

Re: The Sort Problem: a definitive ruling

2004-02-20 Thread Luke Palmer
Smylers writes: > Luke Palmer writes: > > > After this statement: > > > > $x = '345'; > > > > C<$x> is a number. > > Oh. I'd been assuming that quote marks indicated strings, and that, > while a string containing only digits could obviously be treated as a > number (as in Perl 5), it would

Re: The Sort Problem: a definitive ruling

2004-02-20 Thread Dan Sugalski
At 2:49 PM -0700 2/20/04, Luke Palmer wrote: After this statement: $x = '345'; C<$x> is a number. No, it isn't. It's a string. Or, rather, it's a PerlScalar. I should hope it would be treated as one during multimethod dispatch. I should certainly hope *not*. If so, it's a bug. We ought to go

Re: The Sort Problem: a definitive ruling

2004-02-20 Thread Smylers
Luke Palmer writes: > After this statement: > > $x = '345'; > > C<$x> is a number. Oh. I'd been assuming that quote marks indicated strings, and that, while a string containing only digits could obviously be treated as a number (as in Perl 5), it wouldn't be one without being provoked. >

Re: The Sort Problem: a definitive ruling

2004-02-20 Thread Luke Palmer
Smylers writes: > Joe Gottman writes: > > > sort {$_.key} (1=> 'a', 10 => 'b', 2 =>'c'); > > > > There is nothing in the signature of the key-extractor to suggest that > > all the keys are numbers, but as it turns out they all are. > > Are they? I'd been presuming that pair keys would alw

Re: The Sort Problem: a definitive ruling

2004-02-20 Thread Smylers
Joe Gottman writes: > sort {$_.key} (1=> 'a', 10 => 'b', 2 =>'c'); > > There is nothing in the signature of the key-extractor to suggest that > all the keys are numbers, but as it turns out they all are. Are they? I'd been presuming that pair keys would always be strings (as for hashes in

Re: The Sort Problem: a definitive ruling

2004-02-20 Thread Luke Palmer
Smylers writes: > Luke Palmer writes: > > > Uri Guttman writes: > > > > > > "DC" == Damian Conway <[EMAIL PROTECTED]> writes: > > > > > DC> @sorted = sort {-M}=>{$^b cmp $^a} @unsorted; > > > > > > but there is no comma before @unsorted. is that correct? > > > > Yes. Commas may be

Re: The Sort Problem: a definitive ruling

2004-02-20 Thread Smylers
Luke Palmer writes: > Uri Guttman writes: > > > > "DC" == Damian Conway <[EMAIL PROTECTED]> writes: > > > DC> @sorted = sort {-M}=>{$^b cmp $^a} @unsorted; > > > > but there is no comma before @unsorted. is that correct? > > Yes. Commas may be ommitted on either side of a block whe

1st International Workshop on Interpreted Languages

2004-02-20 Thread Dan Sugalski
It's open for proposals and such. Quoth the organizer: the workshop is now officially announced and the Call for Papers has started http://www.sebastian-bergmann.de/InterpretedLanguages2004/ Look 'em up and put in a paper. Should be fun. -- Dan