On Jul 7, 5:02 am, Mike <cki...@gmail.com> wrote:
> (not sure where my reply to Chouser et al. went, but basically I said
> that I was writing a macro and I might be overdoing it.  I was right!)
>
> Here's what I was trying to accomplish, but in functions, not macros:
>
> (defn slice
>   "Returns a lazy sequence composed of every nth item of
>    coll, starting from offset."
>   [n offset coll]
>   (if (= offset 0)
>     (take-nth n coll)
>     (take-nth n (drop offset coll))))
[snip]

Your slice function looks similar to the built-in partition:

(defn slice [n offset coll]
  (apply concat (partition 1 n (drop offset coll))))
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google
Groups "Clojure" group.
To post to this group, send email to clojure@googlegroups.com
Note that posts from new members are moderated - please be patient with your 
first post.
To unsubscribe from this group, send email to
clojure+unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/clojure?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to