Hello, what is the correct way (assuming there is one) to create a lazy-seq
with metadata attached? The below works for short seqs, but causes a stack
overflow for large ones, which obviously means the lazy-seq mechanism is
altered/broken if wrapped with `with-meta`. So I guess there must be
another way...

(defn meta-test
  [i]
  (with-meta
    (lazy-seq
      (when (pos? i) (cons i (meta-test (dec i)))))
    {:range i}))

(meta (meta-test 100))
; => {:range 100}

Thanks for any insights!
K.

-- 
-- 
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
--- 
You received this message because you are subscribed to the Google Groups 
"Clojure" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to clojure+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.


Reply via email to