Hi,
Started tinkering with Clojure, and wonderring why (take-nth 0 (range
10)) returns an infinite sequence .. Is this really the expected
behaviour?
;
;code bellow is public domain
;
(defn take-nth-proposal
"Returns a lazy seq of every nth item in coll . Or nil if n less
than 1."
[n coll]
(if (< n 1)
nil
(lazy-seq
(when-let [s (seq coll)]
(cons (first s) (take-nth n (drop n s)))))))
-Cheers, Alex
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google
Groups "Clojure" group.
To post to this group, send email to [email protected]
Note that posts from new members are moderated - please be patient with your
first post.
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
-~----------~----~----~----~------~----~------~--~---