Skip to content

Instantly share code, notes, and snippets.

@kohyama kohyama/tails.clj
Last active Oct 19, 2017

Embed
What would you like to do?
get a seq of tail seqs for a seq, not including '()
(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
You can’t perform that action at this time.