|
|
|
|
|
by bmn__
2743 days ago
|
|
The language is happy to accommodate any style you like best, including oneliners. sub work($n) { say $n }
my @numbers = 1..100;
# rubyish
@numbers.grep(* > 10 && * %% 2).map(&work);
# lol turbo haskal
map &work <== grep * %% 2 <== grep * > 10 <== @numbers;
# same, but in proper reading direction
@numbers ==> grep * > 10 ==> grep * %% 2 ==> map &work;
The traditional function composition operator exists, see https://docs.perl6.org/routine/%E2%88%98 |
|