Skip to content

Instantly share code, notes, and snippets.

@siefca
Created July 23, 2021 23:35
Show Gist options
  • Save siefca/6e5c229c60d7f98df31c42f716ec1efa to your computer and use it in GitHub Desktop.
Save siefca/6e5c229c60d7f98df31c42f716ec1efa to your computer and use it in GitHub Desktop.
Outof function, reverse of into
(defn outof
([] [])
([of] of)
([of what]
(if (instance? clojure.lang.IEditableCollection of)
(with-meta (persistent! (reduce disj! (transient of) what)) (meta of))
(reduce disj of what)))
([of xform what]
(if (instance? clojure.lang.IEditableCollection of)
(with-meta (persistent! (transduce xform disj! (transient of) what)) (meta of))
(transduce xform disj of what))))
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment