Dave Whipp wrote:

But the squiggly arrow doesn't seem right. I contrast it with the anonymous
sub composer ("->") which was chosen, I think, because it worked well in
the context of a C<for> loop. Consider the following:

  $\ = "|";  $, = ",";
Except, of course, those won't exist in Perl 6.
You want something like:

	$*STDOUT.ors("|");
	$*STDOUT.ofs(",");

  1,2,3 -> { print } # 1,2,3
Err, no. That generates the list: (1, 2, 3, sub(){print})


  1,2,3 ~> print;    # 1,2,3
Yes. Except it's: 1,2,3|


  1,2,3 ~> -> { print } # 1,2,3, but ugly
No. That's an error since you're specifying that the pointy sub
takes no parameters, and then trying to pass it three.


  for 1,2,3 -> { print } # 1|2|3
Yes. Though the output is actually 1|2|3|
And the -> is redundant.


  for 1,2,3 ~> print;    # 1|2|3, but syntax error (*)
Kinda. The C<for> is missing its block. So it won't actually compile.
So the C<print> won't be called. But, if it had been:

	for 1,2,3 ~> print {...}

then you get 1|2|3|


  for 1,2,3 print;       # 1|2|3, but syntax error
Huh? Just a syntax error, I think.
On the other hand:

    for (1,2,3), &print;

works, and isn't an error.


  all(1,2,3) ~> print     # "junction(1,2,3)"
No. You can't print junctions directly. You have to say how
you want them serialized. For example:

    all(1,2,3).values ~> print     # prints: 1,2,3|
    all(1,2,3).dump   ~> print     # prints: all(1,2,3)
    all(1,2,3).pick   ~> print     # prints on the values at random


  all(1,2,3) -> { print } # 1|2|3, but random order
This is the two-element list: ( 1|2|3, sub(){print} )


p.s. has Larry finished with those LoTR DVDs yet?
Probably.

We should bear in mind that Larry has had some health issues.
And that he's currently unemployed with four children to support.
Other matters are taking precedence at the moment.

Damian

Reply via email to