On 4/9/12 9:10 PM, Cedric Greevey wrote:
On Mon, Apr 9, 2012 at 10:31 PM, Andrew<ache...@gmail.com>  wrote:
Given a lazy sequence of numbers is there a way to interleave a constant and
get another lazy sequence? Say the first sequence is 1 2 3 4 ... I'd like
the second sequence to be 1 0 2 0 3 0 4 0 ....

Thanks in advance!
user=>  (interpose 0 [1 2 3 4 5])
(1 0 2 0 3 0 4 0 5)
user=>


Ah, I forgot about that one!

As an aside.. I just looked at the source for this, what does the :static tag in the metadata do?

(defn interpose
  "Returns a lazy seq of the elements of coll separated by sep"
  {:added "1.0"
   :static true}
  [sep coll] (drop 1 (interleave (repeat sep) 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