many thanks for this! :)
btw, is there any place where one can find your discussion between you
and Christophe? I'd love to know more about equiv...alternatively, do
you plan on making public what you've learned in some sort of demo/tutorial?
Jim
On 14/05/13 09:29, Mark Engelberg wrote:
As part of the instaparse library, I created a wrapper around
Clojure's vectors that keeps the hashcode updated as the vector is
modified. In scenarios where you take a vector and then hash, then
modify, then hash, then modify, then hash, etc., this strategy of
"incremental hashing" is essential to performance. Otherwise, Clojure
traverses every element in the modified vector to compute the new hash.
I have documented this new datatype. It's very simple to use, simply
call ivec instead of vec to create it and use it as you'd use a vector
(with some obvious exceptions, for example, you can't add something
unhashable, like an infinite sequence, to the vector, since it hashes
the items as they are added).
https://github.com/Engelberg/instaparse/blob/master/docs/IncrementalVectors.md
Code is here:
https://github.com/Engelberg/instaparse/blob/master/src/instaparse/incremental_vector.clj
Feel free to use it in your own projects.
Thanks to Christophe Grand who provided guidance on some of the
subtleties of simulating vectors. For example, I had a lot of
confusion about equal vs equiv which he helped to clear up.
--
--
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
---
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 [email protected].
For more options, visit https://groups.google.com/groups/opt_out.
--
--
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
---
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 [email protected].
For more options, visit https://groups.google.com/groups/opt_out.