is your programming language high-level enough?
primes = [2..] \ [[p², p²+p ..] | p <- primes]
((g<=<f)=<<) = (g=<<).(f=<<) = join.(g<$>).join.(f<$>)
in a declarative language,
length(a) == 0is the same asnull(a),
and[y | x <- [1..], y <- []]is just[].
apply (FUNARG lambda env) xs a = apply lambda xs env
(g ~~>! h) f x = case g x of [] -> f x; (y:_) -> h y
What's in a powerset? A set's subsets...
1:foldr (\n s->fix (merge s.(n:).map (n*))) [] [2,3,5]
ordfactors = foldr g [1] . reverse . primePowers where
slice hi w = (c, sortBy (compare `on` fst) b) where
(define (call/cc& proc& k) (proc& k k))
(define (list . xs) xs)
How Monads are considered Pure?
Monads are EDSLs are Nested Loops are Trees:
do { [1,2,3] ; [4,5] } =>
do { x <- [1,2,3] ; do { y <- [4,5] ; return y }} =>
for x from [1,2,3] { for y from [4,5] { yield y }} =>
[ 4,5, 4,5, 4,5 ]