andf
Wanna play golf? (defn filter-collecting [predicate collector & lists] (lazy-seq (loop [lists lists out []] (if (empty? (first lists)) (reverse out) (let [heads (map first lists)] (if (apply predicate heads) (recur (map rest lists) (cons (apply collector heads) out)) (recur (map rest lists) out))))))) ;; usage: ;; (filter-collecting < + ;; [1 7 3 9] ;; [5 5 5 5]) ;; ==> (6 8)
なんというArc3向け問題。
(def filter-collecting (p c . l) (rem no (apply map p+c l)))
ArcをベースにGolf用Lisp作ってる人とかいないかな。