Thank you :)

Extremely clear !

On Friday, August 7, 2015 at 3:48:14 PM UTC+2, Stuart Sierra wrote:
>
> Hi Simone,
>
> The stack overflow here is caused by the REPL trying to print a circular 
> reference. `swap!` always returns the new value of the Atom, and the REPL 
> tries to print it.
>
> If you don't print the Atom, this self-reference can still work:
>
> user=> (def a (atom {}))
> #'user/a
> user=> (do (swap! a assoc :self a) nil)
> nil
> user=> (= a (:self @a))
> true
>
> –S
>
>
> On Friday, August 7, 2015 at 9:42:05 AM UTC-4, Simone Mosciatti wrote:
>>
>> Hi all,
>>
>> I noticed this behaviour that I was not expecting:
>>
>> simo@simo:~$ lein repl
>> nREPL server started on port 42010 on host 127.0.0.1 - nrepl://
>> 127.0.0.1:42010
>> REPL-y 0.3.5, nREPL 0.2.6
>> Clojure 1.6.0
>> OpenJDK 64-Bit Server VM 1.7.0_79-b14
>>     Docs: (doc function-name-here)
>>           (find-doc "part-of-name-here")
>>   Source: (source function-name-here)
>>  Javadoc: (javadoc java-object-or-class-here)
>>     Exit: Control+D or (exit) or (quit)
>>  Results: Stored in vars *1, *2, *3, an exception in *e
>>
>> user=> (def a (atom {}))
>> #'user/a
>> user=> (swap! a assoc :self a)
>>
>> StackOverflowError   java.util.regex.Pattern$GroupHead.match 
>> (Pattern.java:4556)
>> user=> (swap! a assoc :test :ok)
>>
>> StackOverflowError   java.lang.Character.codePointAt (Character.java:4668)
>> user=> a
>>
>> StackOverflowError   java.util.regex.Pattern$Curly.match0 
>> (Pattern.java:4148)
>> user=> (def b (atom {}))
>> #'user/b
>> user=> (swap! b assoc :test :ok)
>> {:test :ok}
>>
>> It is something expected or I should open a bug report ?
>>
>> Greets
>>
>> Simone
>>
>

-- 
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