Eh. Not just any collisions, but only ones where the succession of tails
are equal-as-seqs but not identical as objects (.equals, but not ==) for
"sufficiently long". So seqs that differ after only a trillion items would
blow up. So would equal ones sharing no tail structure. Putting (iterate
inc 0
Hrm. Sounds like getting the hash of an infinite sequence will hang or
cause OOME.
On the one hand, *most* uses of the hash are followed by .equals if the
hashes match, and .equals on an infinite seq can't work, since if it gives
up and says "equal" after some large number N of elements, the seqs
Found a post on clojure-dev about this
https://groups.google.com/forum/?fromgroups=#!topic/clojure-dev/F68GRPrbfWo
On Fri, Mar 22, 2013 at 1:29 AM, Nelson Morris wrote:
> If I'm reading everything correctly:
>
> 1. Object 's .toString uses .hashCode()
> 2. LazySeq 's .hashCode() uses seq() which
If I'm reading everything correctly:
1. Object 's .toString uses .hashCode()
2. LazySeq 's .hashCode() uses seq() which realizes a seq.
3. LazySeq 's .hashCode() calls .hashCode() on the realized seq
3. (map ..) creates a LazySeq with a fn to create (cons val (lazy-seq
(map f rest)))
4. (cons ...
I am deeply puzzled abouth the behavior of *.toString* invocation on a lazy
sequence.
==> (.getClass (map println (range 100)))
clojure.lang.LazySeq
==> (.toString (map println (range 100)))
*;;* *integers 0..100 printed*
"clojure.lang.LazySeq@590b4b81"
It should be obvious from the output, but
On Thu, Mar 21, 2013 at 11:54 AM, Razvan Rotaru wrote:
> Is there an alternative to the code above (preferably simple and elegant),
> which will return the etire sequence?
>
(pr-str (map + [1 2 3]))
or
(print-str (map + [1 2 3]))
There are subtle differences between pr-str and print-str, (which
On Mar 21, 2013, at 2:30 PM, Brian Marick wrote:
> If you don't mind brackets
Or, if you do mind brackets:
user=> (str (apply list (map inc [1 2 3])))
"(2 3 4)"
I'll stop now.
Looking for employment as a Clojure programmer
Latest book: /Functional Programming for the Object-Oriented
On Mar 21, 2013, at 2:20 PM, Brian Marick wrote:
> I don't know if it's elegant, but:
>
> user=> (str (list* (map + [1 2 3])))
> "(1 2 3)"
I wrote too soon. `list*` returns a lazy sequence, not a list, so I guess you
shouldn't rely on it. If you don't mind brackets even though lazy sequences
On Mar 21, 2013, at 1:54 PM, Razvan Rotaru wrote:
> I'm curious, why doesn't toString of clojure.lang.LazySeq return the entire
> sequence as a String, and returns the Java pointer instead?
I don't know, but perhaps it's to avoid problems with infinite sequences?
(Although it's interesting th
Hi,
I'm curious, why doesn't toString of clojure.lang.LazySeq return the entire
sequence as a String, and returns the Java pointer instead? I find it
annoying when I do this:
user> (str (map + [1 2 3]))
"clojure.lang.LazySeq@7861"
What's the reason behind this decision? Shouldn't toString tr
10 matches
Mail list logo