Created
May 2, 2013 07:07
-
-
Save devn/5500611 to your computer and use it in GitHub Desktop.
This file contains 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 remove-first [pred coll] | |
(let [[xs ys] (split-with (complement pred) coll)] | |
(concat xs (rest ys)))) | |
(remove-first (partial = 3) [1 2 3 1 2 3]) | |
;;; (1 2 1 2 3) | |
(remove-first even? [1 2 3 1 2 3]) | |
;;; (1 3 1 2 3) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment