LazySeq extends AFn, so you can't change the metadata once the object
exists. However, Seq's still accept meta-data, so:
(with-meta (seq (concat [1 3] [8 4]))
{:tail true})
--Chouser
I'm not sure it's desirable to have metadata on seqs (it bit me while
transitionning to lazy) but I have thought of two ways to add withMeta
to a LazySeq:
* to have meta()/withMeta() to force evaluation of the inner seq (and it
begs the question to know whether (= (meta a) (meta (lazy-seq a)))
should be true),
* to have withMeta() to return some kind proxy on the LazySeq object
(cannot this approach also works for regular closures?).
BTW, speaking of regular closures, would it be possible to be able to
set "static" metadata?
eg:
(#^{:meta {:actual :metadata}} fn* [args] body)
(The fn macro could make this prettier.)
Christophe
--
Professional: http://cgrand.net/ (fr)
On Clojure: http://clj-me.blogspot.com/ (en)