On Oct 28, 4:33 pm, Richard Newman <holyg...@gmail.com> wrote:
> I think John's point is this:
>
> user=> (take 3 (repeatedly rand))
> (0.07020342855887218 0.590736243072285 0.04997104958104426)
> user=> (take 3 (repeatedly rand))
> (0.6445602419794128 0.12488917903865004 0.5784287452848529)
>
> Different sequences, even if the generators are the same.
Ah, right.  My gut response to that is if the users are calling
hashCode() on lazy sequences, then they should expect a value which
based on how the sequence is generated.  If they want a hash code
based on the actual values of the sequence, it should be evaluated
with a doall and have hashCode called on the resulting non-lazy
sequence.  This would also make the user consciously face the
possibility of evaluating an infinite sequence rather than it being a
"gotcha" hidden away in hashCode's internals.

That said, I haven't read enough Clojure code in the wild to get a
feel of how upsetting such a change would be.  Creating a hashmap with
lazy sequences as keys seems unintuitive.
--~--~---------~--~----~------------~-------~--~----~
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