Re: Do slurpy parameters auto-flatten arrays?

2005-08-04 Thread TSa (Thomas Sandlaß)
HaloO, Luke Palmer wrote: On 8/3/05, Aankhen <[EMAIL PROTECTED]> wrote: On 8/3/05, Piers Cawley <[EMAIL PROTECTED]> wrote: So how *do* I pass an unflattened array to a function with a slurpy parameter? Good question. I would have thought that one of the major gains from turning arrays and

Re: If topicalization

2005-08-04 Thread Stuart Cook
On 8/4/05, Luke Palmer <[EMAIL PROTECTED]> wrote: > How can that possibly work? If a bare closure { } is equivalent to -> > ?$_ is rw { }, then the normal: > > if foo() {...} > > Turns into: > > if foo() -> ?$_ is rw { } > > And every if topicalizes! I'm sure we don't want that. > > L

Re: zip with ()

2005-08-04 Thread TSa (Thomas Sandlaß)
HaloO, Luke Palmer wrote: On 8/1/05, Ingo Blechschmidt <[EMAIL PROTECTED]> wrote: In general, (@foo, @bar) returns a new list with the element joined, i.e. "@foo.concat(@bar)". If you want to create a list with two sublists, you've to use ([EMAIL PROTECTED], [EMAIL PROTECTED]) or ([EMAIL PROTE

Re: Do slurpy parameters auto-flatten arrays?

2005-08-04 Thread TSa (Thomas Sandlaß)
HaloO, Piers Cawley wrote: By the way, if flattening that way, what's the prototype for zip? We can after all do: zip @ary1, @ary2, @ary3, ... @aryn How about sub zip( List [EMAIL PROTECTED] ) {...} a slurpy List of Array of List. The return value is a not yet iterated Code object tha

TSa's Perl 6 type lattice version 1.0

2005-08-04 Thread TSa (Thomas Sandlaß)
HaloO, in case someone might be interested, here is my more or less complete idea of the Perl 6 type lattice as ASCII art. Enjoy. Comments welcome. ::Any ...| ... ___:___/|\__

Re: zip with ()

2005-08-04 Thread Larry Wall
On Mon, Aug 01, 2005 at 01:13:52PM +0200, "TSa (Thomas Sandlaß)" wrote: : BTW, you didn't mean originally: : : say zip (@odd), (@even); # prints 13572468 or 12345678? That doesn't work, since () in list context does not enforce scalar context. It's exactly equivalent to say zip @odd, @even

$pair[0]?

2005-08-04 Thread Ingo Blechschmidt
Hi, my $pair = (a => 1); say $pair[0]; # a? say $pair[1]; # 1? I've found this in the Pugs testsuite -- is it legal? --Ingo -- Linux, the choice of a GNU | Black holes result when God divides the generation on a dual AMD | universe by zero. Athlon!|

Re: $pair[0]?

2005-08-04 Thread Andrew Shitov
> say $pair[0]; # a? It looks like $pair is an arrayref while 'say ref $pair' tells 'Pair'. And may I ask a relating question: my $pair = ('name' => 'age'); say $pair{'name'}; # prints 'age' say $pair['name']; # why prints 'name'? <== question say $pair['age']; # prints 'name' --

undef.chars?

2005-08-04 Thread Ingo Blechschmidt
Hi, (found in the Pugs testsuite.) my $undef = undef; say $undef.chars? # 0? undef? die? say chars $undef; # 0? undef? die? I'd opt for "undef.chars" to be an error ("no such method") and "chars undef" to return 0 (with a warning printed to STDERR^W$*ERR). Opinions? --Ingo --

Re: $pair[0]?

2005-08-04 Thread Ingo Blechschmidt
Hi, Andrew Shitov wrote: >> say $pair[0]; # a? > > It looks like $pair is an arrayref while 'say ref $pair' tells 'Pair'. right, this is why I asked, IMHO it's bogus. > And may I ask a relating question: > > my $pair = ('name' => 'age'); > say $pair{'name'}; # prints 'age' > say $pair['na

Re: $pair[0]?

2005-08-04 Thread Luke Palmer
On 8/4/05, Ingo Blechschmidt <[EMAIL PROTECTED]> wrote: > Hi, > > my $pair = (a => 1); > say $pair[0]; # a? > say $pair[1]; # 1? > > I've found this in the Pugs testsuite -- is it legal? Nope. That's: say $pair.key; say $pair.value; Also: say $pair; # 1 say $pa

Re: undef.chars?

2005-08-04 Thread Luke Palmer
On 8/4/05, Ingo Blechschmidt <[EMAIL PROTECTED]> wrote: > Hi, > > (found in the Pugs testsuite.) > > my $undef = undef; > say $undef.chars? # 0? undef? die? > say chars $undef; # 0? undef? die? > > I'd opt for "undef.chars" to be an error ("no such method") and "chars > undef" to

Re: $pair[0]?

2005-08-04 Thread Ingo Blechschmidt
Hi, Luke Palmer wrote: > On 8/4/05, Ingo Blechschmidt <[EMAIL PROTECTED]> wrote: >> my $pair = (a => 1); >> say $pair[0]; # a? >> say $pair[1]; # 1? >> >> I've found this in the Pugs testsuite -- is it legal? > > Nope. That's: > > say $pair.key; > say $pair.value; > > Al

Data constructors / Unidirectional unification

2005-08-04 Thread Luke Palmer
I'm writing a new module that optimizes sets of conditions into decision trees. Initially I allowed the user to specify conditions as strings, and if that condition began with a "!", it would be the inverse of the condition without the "!". But then I thought, "the user will more than likely have

Re: undef.chars?

2005-08-04 Thread Brent 'Dax' Royal-Gordon
Luke Palmer <[EMAIL PROTECTED]> wrote: > On 8/4/05, Ingo Blechschmidt <[EMAIL PROTECTED]> wrote: > > my $undef = undef; > > say $undef.chars? # 0? undef? die? > > say chars $undef; # 0? undef? die? > > > > I'd opt for "undef.chars" to be an error ("no such method") and "chars > > un