I want to get a seq of successive rests of the given seq: user> (defn f [seq] (if (empty? seq) nil (lazy-cons seq (f (rest seq))))) #'user/f user> (f '(1 2 3 4)) ((1 2 3 4) (2 3 4) (3 4) (4)) user> (take 10 (map #(take 5 %) (f (iterate inc 1)))) ((1 2 3 4 5) (2 3 4 5 6) (3 4 5 6 7) (4 5 6 7 8) (5 6 7 8 9) (6 7 8 9 10) (7 8 9 10 11) (8 9 10 11 12) (9 10 11 12 13) (10 11 12 13 14))
Does this fn already exist in clojure? If not what would an idiomatic name be for it from Haskell or CL? Andrew --~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "Clojure" group. To post to this group, send email to [email protected] To unsubscribe from this group, send email to [email protected] For more options, visit this group at http://groups.google.com/group/clojure?hl=en -~----------~----~----~----~------~----~------~--~---
