I wrote a function as:

(defn repeated-seq
  [f start]
  (let [coll (f start)]
    (concat coll (lazy-seq (repeated-seq f (last coll))))))

it is OK when I call it with:
(repeated-seq #(range % 5) 0)

the elements are: 0 1 2 3 4 4 5 6 7 8 8 ...

However, I want to get rid of the duplicated index element (4, 8 etc),
e.g.
To produce 0 1 2 3 4 5 6 7 8 9

But when I insert a rest into lazy-seq, the function just hung up.
How can I make this happen?

Thanks.

-- 
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