Another sample for set-ref doc

Started by HPW, August 01, 2013, 05:56:15 AM

Previous topic - Next topic

HPW

When I want to do the same as with the longtime depreciated 'replace-assoc' it would be this:



> (set 'data '(fruits (apples 123 44) (oranges 1 5 3)))
(fruits (apples 123 44) (oranges 1 5 3))
> (set-ref (assoc 'apples data) data '(Apples 456 55))
(fruits (Apples 456 55) (oranges 1 5 3))


Makes for me more sense as a real world example.



Regards
Hans-Peter

Lutz

#1
but an example better handled with setf as explained in the previous thread


(setf (assoc 'apples data) '(Apples 456 55))

HPW

#2
Very nice.



Put both in the doc. ;-)
Hans-Peter