We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
1 parent 3fac7f9 commit aedff0aCopy full SHA for aedff0a
src/algorithm/hamt.lisp
@@ -22,6 +22,7 @@
22
#:contains-p
23
#:difference
24
#:dissoc
25
+ #:dissoc-in
26
#:enable-syntax
27
#:filter
28
#:from-pairs
@@ -535,6 +536,13 @@ Returns (values new-node inserted-p) where inserted-p is true for new insertions
535
536
(node-dissoc (immutable-map-root map) hash 0 key nil))))
537
(make-immutable-map new-root (1- (immutable-map-count map)))))
538
539
+(defun dissoc-in (map keys)
540
+ "Remove a key from a nested MAP structure, where KEYS is a sequence of keys."
541
+ (destructuring-bind (k &rest ks) keys
542
+ (if (null ks)
543
+ (dissoc map k)
544
+ (assoc map k (dissoc-in (get map k +empty+) ks)))))
545
+
546
(defun keys (map)
547
"Return a list of all keys in the map"
548
(mapcar #'car (seq map)))
0 commit comments