A bozo's blog
Wednesday, November 13, 2019
Clojure: if key exists: update, otherwise: assoc
Source :
if key exists: update, otherwise: assoc
1
2
3
4
user> (update {:a [
1
]} :a (fnil conj [])
2
)
{:a [
1
2
]}
user> (update {:a [
1
]} :b (fnil conj [])
2
)
{:a [
1
], :b [
2
]}
Newer Post
Older Post
Home