News for hackers. Stuff that matters.
Re:Why Would Anyone Use Perl 6? by masklinn on Wednesday January 13, 2016 @09:19AM (#10894376)
The first two seem to be set operations ("value in set" and "filter values not in set"), I've no idea what the third one is supposed to do, something like all ((==0).(`rem` 2))?
Re:Why Would Anyone Use Perl 6? by grondilu on Wednesday January 13, 2016 @10:19AM (#10894897)
By set operations I was more specifically thinking of intersection and union. Testing if an element belongs to a set can indeed be done with junctions but that's pretty much it.

The third example shows the so-called auto-threading behavior. I think it's significantly different than what you can do with sets.

A Junction in Perl 6 is "a superposition of data values pretending to be a single value". So for instance any algebraic expression can be used with a junction as if it was a scalar. The result will be a junction.

In this example the expression is $_ %% 2, which is Perl 6's way of writing the boolean statement "the variable $_ is divisible by 2". We use this expression with ($a & $b) instead of $_.

Re:Why Would Anyone Use Perl 6? by bhaak on Wednesday January 13, 2016 @10:10AM (#10894816)
The third seems to be shorthand for map and reduce (or only reduce).

In Ruby, you could express the same with `[2,4,6].reduce(true) {|even,num| even & num.even? }` or more clearer IMO `[2,4,6].map(&:even?).reduce(&:&)`.