Skip to content

Comment on List Comprehensions in Eight Lines of Clojureparent

Comments

Very nice indeed.

NB. Correction to my earlier comment elsewhere here about List::Gen & multiple lists because it does provide cross combinators and also gather/take which is a perl6 way of doing complicated (multi) list comprehensions.

Here are the two examples written in perl6 (which do work in Rakudo).

  gather for 1..6 X 4..6 X 7..9 -> $a, $b, $c { take $a + $b + $c if $a %% 2 }

  gather for ('n', 'p'..'t') X <a i u e o> -> $a, $b { take $a ~ $b }
AboutSource Built by g1lg1l

Hackerly is an independent reader for Hacker News, built on the public HN API. Not affiliated with Y Combinator.