Instantly share code, notes, and snippets.
Stumbled upon this after googling "clojure foldr". I realise this gist is quite old, so I apologise in advance if you feel this is pointless.
The last line should be:
With the change, it is a right-associative fold:
(foldr list () (range 3))
=> (0 (1 (2 ())))
But it isn't lazy like Haskell fold:
(take 2 (foldr list () (range)))
StackOverflowError clojure.lang.RT.first (RT.java:682)