Can't use clojure.core/update

251 views
Skip to first unread message

Daniel Ger

unread,
Jan 20, 2016, 9:00:14 AM1/20/16
to 4Clojure
java.lang.RuntimeException: Unable to resolve symbol: update in this context, compiling:(NO_SOURCE_PATH:0)

The function clojure.core/update seems to be unavailable ( - I get the error message you see above when I try to use it - ), whereas the function clojure.core/update-in, on the other hand, is available.
Why is that?

palo

unread,
Jan 20, 2016, 1:20:03 PM1/20/16
to 4Clojure

java.lang.RuntimeException: Unable to resolve symbol: update in this context, compiling:(NO_SOURCE_PATH:0)

The function clojure.core/update seems to be unavailable ( - I get the error message you see above when I try to use it - ), whereas the function clojure.core/update-in, on the other hand, is available.
Why is that?

Hi

I had the same problem.

The function update was added in version 1.7.

My guess is that, the 4clojure site is using older version of clojure.

You can use the assoc function instead (which is used by the update internally).

Palo

Daniel Ger

unread,
Jan 20, 2016, 5:43:59 PM1/20/16
to 4Clojure
Ah, I see. Thanks a lot for your response.

palo

unread,
Jan 21, 2016, 4:08:48 PM1/21/16
to 4Clojure
Hi

You are welcome.

Palo

Szabolcs Sinka

unread,
May 19, 2017, 4:23:16 PM5/19/17
to 4Clojure
Well, there is some difference.

update accepts a function that gets the old value of the key as its 1st arg and will return the new value - like swap. (Also you can add more args that will be applied to the updater function.)
Reply all
Reply to author
Forward
0 new messages