foldr

自作。

(defn foldr [f init lst]
  (if (empty? lst) init
      (f (first lst) (foldr f init (rest lst)))))

うーむ、しかし再帰を外すことはできるのか?

http://lispuser.net/memo/lisp/2007-05-29-23-08.html
に習ってfoldの実験。

user=> (reduce #(cons %2 %1) '() [1 2 3 4])
(4 3 2 1)

foldの代わりにreduceをそのまま使うときは、
consの書き方を注意しないといけない。