Guest User

Untitled

a guest
Feb 16th, 2011
190
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Lisp 0.40 KB | None | 0 0
  1. (defn merge-chains
  2.   [chain1 chain2 & more]
  3.   (let [merge-two-chains (fn [ch1 ch2]
  4.                            (let [to-insert (chain->pairs ch2)
  5.                                  insertions (for [pair to-insert]
  6.                                               `(insert-pair ~pair))]
  7.                              (apply doto ch1 insertions)))]
  8.     (reduce merge-two-chains (apply list chain1 chain2 more))))
Advertisement
Add Comment
Please, Sign In to add comment