I'm just a
bit amazed that you would go away and write clojure code to consume JSON
and all that, without realising that data-structures in Clojure are
immutable!
That part is obvious enough, but I thought the new data structures
returned from assoc were being handed to map which then, in
I would like 2 types of advice:
1.) an answer to this specific question
2.) advice on how one is suppose to debug mysteries likes this
I have a simple web app that serves some data (hopefully in JSON
format, but at the moment I will accept anything at all). The app uses
Ring and Moustache and
larry google groups lawrencecloj...@gmail.com writes:
We put some data in this atom. And then we output it. But I have had
great difficulty getting anything to appear on the screen. Assuming
the problem was with the fact the main sequence was lazy, I added in
doall everywhere it made sense.
Couple of initial things, Clojure has immutable data structures so
when you call for example 'assoc' it will return you a new map with
the new values assoc'd. It will not mutate the original, so:
(let [foo {}]
(assoc foo :a 1)
(assoc foo :b 2)
foo)
Will return {}. You need to do something
the 2 previous responses answered your question perfectly ...I'm just a
bit amazed that you would go away and write clojure code to consume JSON
and all that, without realising that data-structures in Clojure are
immutable! I think we can all agree they are *the* cornerstone of
Clojure. It is