-
-
Save 6ewis/07ec1af12198dbd5105fb45a37831e92 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
(fn [a-seq] | |
(loop [out [], updated-seq a-seq] | |
(let [[first-element & rest-of-seq] updated-seq] | |
(if (nil? first-element) | |
out | |
(recur (conj (seq out) first-element) rest-of-seq))))) | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
that behaves weird if theres nil in the list: the following is better: