Re: Unexpected behaviour of transient map

2017-11-27 Thread Andy Fingerhut
I know they aren't "official" Clojure documentation, but the examples and comments at clojuredocs.org are often correct, and even sometimes illuminating. http://clojuredocs.org/clojure.core/assoc! All of the clojuredocs.org pages for transient operations refer to that one for a more full

Re: Unexpected behaviour of transient map

2017-11-27 Thread Mark Melling
Thanks, that is useful advice. I do think that the docstring for assoc! could be more explicit about the dangers of not using the return value. Given the value placed in experimenting in the REPL it's easy to see how one could be fooled into using assoc! incorrectly. On Friday, 24 November

Re: Unexpected behaviour of transient map

2017-11-25 Thread Matching Socks
A docstring need not be a rope ladder that leads to all truth. (That would be a project for the IDE documentation access improvement brigade.) But the docstring of "assoc!" feints in a direction that makes this a frequently-asked question. -- You received this message because you are

Re: Unexpected behaviour of transient map

2017-11-25 Thread Mikhail Gusarov
Hello. The reader of any particular docstring cannot be expected to magically know that there is another, better, piece of documentation. Regards, Mikhail On Sat, 25 Nov 2017, at 02:10, Timothy Baldridge wrote: > But this behavior is already documented in the official transients > overview at

Re: Unexpected behaviour of transient map

2017-11-24 Thread Timothy Baldridge
But this behavior is already documented in the official transients overview at http://clojure.org/transients On Fri, Nov 24, 2017 at 5:46 PM Matching Socks wrote: > I would go so far as to (light-heartedly) call the "assoc!" docstring > booby-trapped. > > There is an open

Re: Unexpected behaviour of transient map

2017-11-24 Thread Matching Socks
I would go so far as to (light-heartedly) call the "assoc!" docstring booby-trapped. There is an open issue in Jira for it. Go vote: https://dev.clojure.org/jira/browse/CLJ-1385 -- You received this message because you are subscribed to the Google Groups "Clojure" group. To post to this

Re: Unexpected behaviour of transient map

2017-11-24 Thread Stuart Sierra
The way I like to think of it, if it helps: Transients are still *immutable*, but they are not *persistent*. Each new value *invalidates* the previous value. –S On Friday, November 24, 2017 at 11:01:48 AM UTC-5, Alex Miller wrote: > > Transients must still be used in the same calling pattern

Unexpected behaviour of transient map

2017-11-24 Thread Alex Miller
Transients must still be used in the same calling pattern as persistent data structures. That is, you must use the value returned from the ! call to make the next call. What you’re seeing is a side effect of the way transients are implemented, but if used correctly you won’t have this issue.

Unexpected behaviour of transient map

2017-11-24 Thread Mark Melling
Hi, I was investigating an issue in a library which defines a macro that uses transients, and discovered some unexpected behaviour (at least unexpected to me). I would really appreciated it if someone could shed some light on this behaviour and the best way of dealing with it. If I do