Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- ;; I'm not sure e.g.
- ;; (mapf (cycle f1 f2 f3) collection)
- ;; is a big improvement over
- ;; (map #(%1 %2) (cycle f1 f2 f3) collection)
- ;;
- ;; In theory, this would have to be further generalized to any number of
- ;; collections (a la map).
- (defn mapf [fs coll]
- (lazy-seq
- (when-let [fns (seq fs)
- s (seq coll)]
- (cons ((first fns) (first s)) (mapf (rest fns) (rest s))))))
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement