Skip to content

Instantly share code, notes, and snippets.

@raek
Created January 27, 2012 09:07
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save raek/1687882 to your computer and use it in GitHub Desktop.
Save raek/1687882 to your computer and use it in GitHub Desktop.
(defn rests [coll]
(lazy-seq
(if (seq coll)
(cons (seq coll) (rests (rest coll)))
(list ()))))
(defn f [xs]
(let [g (fn [x xs]
(for [y (rest xs)]
[x y]))]
(mapcat g xs (rests xs))))
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment