Last active
October 19, 2017 09:05
-
-
Save kohyama/1708173 to your computer and use it in GitHub Desktop.
get a seq of tail seqs for a seq, not including '()
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
(require '[clojure.test :refer (with-test is run-tests)]) | |
(with-test | |
(defn tails [coll] | |
(take-while seq (iterate rest coll))) | |
(is (= (tails '(:a :b :c)) | |
'((:a :b :c) (:b :c) (:c))))) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment