function
boot.janet on line 1357, column 1
(update-in ds ks f & args)
Update a value in a nested data structure by applying f to the
current value. Looks into the data structure via a sequence of keys.
Missing data structures will be replaced with tables. Returns the
modified, original data structure.
(defn ddup [ds ks val]
(update-in ds ks
(fn [x]
(if (= nil x)
@[val]
(array/push x val)))))
(var a @{})
(ddup a [:a] 1)
(ddup a [:a] 2)
(ddup a [:a] 3)
# @{:a @[1 2 3]}
(update-in @{:a @{:b 1}} [:a :b] (fn [x] (+ 1 x)))
# @{:a @{:b 2}}
(update-in @{:a 1} [:a] (fn [x] (+ 1 x)))
# @{:a 2}