... but what if this is exactly what I need?
I'm working with Lucene and I have my custom Collector. This collector
accept fn as a constructor argument and then for each matched document it
gathers needed information from the fields of document, builds some useful
clojure object and passes it back to fn.
Here is the example, where the goal is just to collect all results into the
vector, and I used transients here, which are updated in-place and I'm
ignoring (conj! ..) returned value:
(let [v (transient [])
f (fn [obj]
(conj! v obj))]
(.search searcher (MatchAllDocsQuery.) (MyCustomCollector. f))
(persistent! v))
Looks nice to me. And it works. But then I noticed this statement on
http://clojure.org/Transients page:
"Note in particular that transients are not designed to be bashed in-place."
Does it mean that some future version of Clojure may broke my code?
--
You received this message because you are subscribed to the Google
Groups "Clojure" group.
To post to this group, send email to [email protected]
Note that posts from new members are moderated - please be patient with your
first post.
To unsubscribe from this group, send email to
[email protected]
For more options, visit this group at
http://groups.google.com/group/clojure?hl=en