Austin Hastings writes:
> > Sortof. I think Larry was implying that rand returned an infinite list
> > of random numbers in list context. If not, then what he said was wrong,
> > because it would be sick to say that:
> >
> > (1,2,3,4,5) Â+Â foo()
> >
> > Calls foo() 5 times.
>
> Why would it be sick, and in what context?
>
> With Larry's new "vectorized sides" suggestion, putting a guillemot on the right
> side of the operator vectorizes the right side operand, which *should* call foo()
> five times.
>
> (1,2,3,4,5) Â+ foo() # do { my $x=foo(); (1+$x, 2+$x, 3+$x, 4+$x, 5+$x); }
> (1,2,3,4,5) Â+Â foo() # (1+foo(), 2+foo(), 3+foo(), 4+foo(), 5+foo())
I think that one is:
do { my @x=foo(); ([EMAIL PROTECTED], [EMAIL PROTECTED], [EMAIL PROTECTED], [EMAIL
PROTECTED], [EMAIL PROTECTED]) }
We've forgotten that foo() could return a list in list context. :-)
> (1,2,3,4,5) +Â foo() # Maybe the same as above? What does
> infix:+(@list,$scalar) do?
Well, what does a list return in scalar context? In the presence of the
C comma, it returns 5 for the last thing evaluated. In its absence, it
returns 5 for the length.
> (1,2,3,4,5) + foo() # foo() in list context? What does infix:+(@list,
> @list2) do?
Same deal, 5 + $(foo())
Luke
Ã