Created
July 23, 2021 23:35
-
-
Save siefca/6e5c229c60d7f98df31c42f716ec1efa to your computer and use it in GitHub Desktop.
Outof function, reverse of into
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
(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