(sorry for yet another p6l email mentioning junctions; if they annoy you
just ignore this mail :-)

while reviewing some tests I found the "each() comprehension" in S02
that evaded my attention so far.

Do we really want to keep such a rather obscure syntactic
transformation? I find an explicit grep much more readable; if we want
it to work in a more general case, it might become some kind of junction
that, on autothreading, keeps a mapping between the original item and
the new value, and on collapse returns all items for which the new value
is true. Something along these lines:

 g(each(1 => f(1), 2 => f(2), 3 => f(3)))
 each(1 => g(f(1)), 2 => g(f(2)), 3 => (g(f(3)))
and on collapse returns

IMHO this would DWIM more in arbitrary code than the special syntactic
form envisioned

Also this part of S02 is rather obscure, IMHO:

>  In particular,
>    @result = each(@x) ~~ {...};
> is equivalent to
>    @result = @x.grep:{...};

Should it be @result = @x.grep:{ $_ ~~ ... } instead? Otherwise

'each(@x) ~~ 1..3' would be transformed into '@x.grep:{1..3}', which
would return the full list. (Or do adverbial blocks some magic smart
matching that I'm not aware of?)


Reply via email to