What's surprising about this?  Maybe you want the promoting *' variant:

> (def expexp (lazy-cat [2] (map #(*' % %) expexp)))
#'sandbox21201/expexp
> (take 100 expexp)
Execution Timed Out!

Seems like it's a big number :-)


On Mon, Jun 13, 2016 at 4:27 PM Sebastian Oberhoff <
oberhoff.sebast...@gmail.com> wrote:

> The following lines are copied straight from tryclj.com
>
> > (def expexp (lazy-cat [2] (map #(* % %) expexp)))
> #'sandbox20298/expexp
> > (take 100 expexp)
> java.lang.ArithmeticException: integer overflow
> > (take 100 expexp)
> (2 4 16 256 65536 4294967296)
>
> I'm wondering if this behavior is known, because I was really surprised by
> this. Couldn't this lead to some really subtle bugs downstream?
>
> (I just went back to doublecheck and now I'm getting an unbound var for
> expexp on tryclj.com. It still behaves like this on my local machine
> though.)
>
> --
> 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