Created
December 31, 2015 04:12
-
-
Save RSNara/08c4fefa830bf3a53876 to your computer and use it in GitHub Desktop.
A lazy implementation of filter.
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 my-filter [predicate? collection] | |
(lazy-seq | |
(loop [[head & tail] collection] | |
(if (predicate? head) | |
(cons head (my-filter predicate? tail)) | |
(if (seq tail) | |
(recur tail) | |
()))))) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment