Skip to content

Instantly share code, notes, and snippets.

What would you like to do?
(defn unconj [coll]
(when (seq coll)
(let [x ((if (vector? coll) peek first) coll)]
(list? coll) (rest coll)
(vector? coll) (subvec coll 0 (dec (count coll)))
(set? coll) (disj coll x)
(map? coll) (dissoc coll (x 0)))
;; forall coll, (seq coll) => (= (apply conj (unconj coll)) coll)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.