Clojure 1.5.1
user=>  (def bar (cons 1 (map #(do (println %) (+ (nth bar %) %)) (range))))
#'user/bar
user=> (take 10 bar)
(0
1
IndexOutOfBoundsException   clojure.lang.RT.nthFrom (RT.java:795)


It is possible that it is lein/REPLy that's causing the output not to
be print, I've seen it done a number of times.


On Fri, Feb 13, 2015 at 8:02 AM, Fluid Dynamics <a2093...@trbvm.com> wrote:
> And here's some really crazy behavior from 1.5.1!
>
> => (def bar (cons 1 (map #(do (println %) (+ #_(nth bar %) %)) (range))))
> #'user/bar
> => (take 10 bar)
> (0
>
> 1
> 2
> 3
> 4
> 5
> 6
> 7
> 8
> 9
> 10
> 11
> 12
> 13
> 14
> 15
> 16
> 17
> 18
> 19
> 20
> 21
> 22
> 23
> 24
> 25
> 26
> 27
> 28
> 29
> 30
> 31
> 1 0 1 2 3 4 5 6 7 8)
> => (def bar (cons 1 (map #(do (println %) (+ (nth bar %) %)) (range))))
> #'user/bar
> => (take 10 bar)
> IndexOutOfBoundsException   clojure.lang.RT.nthFrom (RT.java:795)
>
> Erm, what? There should have been at least one number printed by the
> (println %) before the (nth bar %) could possibly have blown up.
> Furthermore, the *first* round of prints shows that % was never out of range
> for an infinite lazy sequence, i.e. was never negative. So 1.5.1 is actually
> behaving *schizophrenically* here: a bare delay that recursively forces
> itself overflows the stack, but the delay for the next-part of a ChunkedSeq
> is instead apparently being seen as holding nil when forced inside its own
> evaluation. But a delay is a delay is a delay and the same behavior should
> occur consistently, nil or an exception, no matter where the delay is
> "located"!
>
> --
> 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
> ---
> 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 clojure+unsubscr...@googlegroups.com.
> For more options, visit https://groups.google.com/d/optout.

-- 
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
--- 
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 clojure+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Reply via email to