in reply to Re^2: Perl6 Contest #2: P6 That Doesn't Look Like P5
in thread Perl6 Contest #2: P6 That Doesn't Look Like P5
Although allowing map to take multiple items from the list at once would be nicer, and it's something I've wanted rather often.
Sure, works in current Pugs! :)
@result = map { $^a + $^b } 1,2,3,4; # 3,7 @result = map -> $a, $b { $a + $^b } 1,2,3,4; # 3,7 # And: $result = reduce { $^a + $^b * $^c } 1,2,3,4,5; # same as $result = (1 + 2 * 3) + 4 * 5; # i.e. # 27
--Ingo
|
---|