Skip to content

Instantly share code, notes, and snippets.

@Sophia-Gold
Created March 17, 2018 03:29
Show Gist options
  • Select an option

  • Save Sophia-Gold/fd146cf5b4aafc35856f3c95f835ce0e to your computer and use it in GitHub Desktop.

Select an option

Save Sophia-Gold/fd146cf5b4aafc35856f3c95f835ce0e to your computer and use it in GitHub Desktop.
Difference Lists in Clojure
(defn dl
[& elements]
(fn [x] (concat elements x)))
(defn dl-un
[l]
(l nil))
(defn dl-concat
[& lists]
(fn [x] ((apply comp lists) x)))
(def example (dl-un (dl-concat (dl 1) (dl 2 3) (dl) (dl 4))))
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment