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
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
LP> my $x = (1,2,3,4,5);
LP> Looks like an error more than anything else.
'Perl 6 and Parrot Essentials' think different ;-)
--
___
Andrew, [EMAIL PROTECTED]
___
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 PROTECTED],
> [EMAIL PROTECTE
Hi,
TSa (Thomas Sandlaß orthogon.com> writes:
> Ingo Blechschmidt wrote:
> > say zip (@odd, @even); # &zip gets only one argument, the flattened
> > # list ( @odd, @even), containing the
>
> Why flattened? Shouldn't that be *(@odd, @even)?
IIUC:
say zip *(@o
HaloO,
Andrew Shitov wrote:
TTS> BTW, you didn't mean originally:
TTS>say zip (@odd), (@even); # prints 13572468 or 12345678?
That is exactly like with similar printing result of sub() call:
print sqrt (16), 5; # shout print 45.
That all hinges on the type of the symbol. I guess &s
HaloO,
Ingo Blechschmidt wrote:
Whitespace is significant:
say zip @odd, @even;# &zip gets two arguments, result is
# 12345678.
say zip(@odd, @even); # &zip gets two arguments, result is
# 12345678.
say zip (@odd, @even);
TTS> BTW, you didn't mean originally:
TTS>say zip (@odd), (@even); # prints 13572468 or 12345678?
That is exactly like with similar printing result of sub() call:
print sqrt (16), 5; # shout print 45.
--
___
Андр
HaloO,
Andrew Shitov wrote:
Is it possible to avoid significance of whitespaces?
Yes, with:
say zip .(@odd, @even);
Looks like a method and *is* a method in my eyes.
First &zip is looked-up and then bound as block owner.
Arguments are of course two array refs to @odd and @even
respectively
Is it possible to avoid significance of whitespaces?
I think, such an aspect of Perl 6 would be awful.
IB> Whitespace is significant:
IB> say zip(@odd, @even);
IB> say zip (@odd, @even);
--
___
Andrew, [EMAIL PROTEC
Hi,
Andrew Shitov wrote:
> I tried zip under pugs.
>
> my @odd = (1, 3, 5, 7);
> my @even = (2, 4, 6, 8);
> my @bothA = zip @odd, @even;
> print @bothA;
>
> This code prints 12345678 as expected.
>
> After parenthesis were used to group zip arguments, results changes
> to 135724
Hi,
I tried zip under pugs.
my @odd = (1, 3, 5, 7);
my @even = (2, 4, 6, 8);
my @bothA = zip @odd, @even;
print @bothA;
This code prints 12345678 as expected.
After parenthesis were used to group zip arguments, results changes
to 13572468. Is it right?
--
__
12 matches
Mail list logo