Commit 2dfc9b54 authored by Attila Lendvai's avatar Attila Lendvai
Browse files

fix: assoc-value setter now always returns the new value

parent aece3dac
......@@ -41,7 +41,7 @@ property list PLIST in the same order."
(get-setf-expansion place env)
(when (cdr newvals)
(error "~A cannot store multiple values in one place" ',name))
(with-unique-names (new-entry key-val test-val alist entry)
(with-unique-names (new-value key-val test-val alist entry)
(values
(append temporary-variables
(list alist
......@@ -53,14 +53,15 @@ property list PLIST in the same order."
key
test
`(,',get-entry ,key-val ,alist :test ,test-val)))
`(,new-entry)
`(,new-value)
`(cond
(,entry
(setf (,',get-value-from-entry ,entry) ,new-entry))
(setf (,',get-value-from-entry ,entry) ,new-value))
(t
(let ,newvals
(setf ,(first newvals) (,',add ,key ,new-entry ,alist))
,setter)))
(setf ,(first newvals) (,',add ,key ,new-value ,alist))
,setter
,new-value)))
`(,',get-value-from-entry ,entry))))))))
(define-alist-get assoc-value assoc cdr acons
"ASSOC-VALUE is an alist accessor very much like ASSOC, but it can
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment