More bug-fixes for the 9.3 release on February 1st.
Files and changes notes: http://newlisp.org/downloads/development/
Lutz
Hi Lutz!
Thanks for the new release.
I've been incorporating the new syntax of assoc and set-assoc into the latest FOOP script and was surprised set-assoc didn't work like replace-assoc in the following way:
(replace-assoc Lid (Jar (Lid))) ;=> (Jar) and $0 is (Lid)
(set '$0 nil)
(set-assoc ((Jar (Lid)) Lid)) ;=> (Jar (Lid)) and $0 is (Lid)
Is this intentional?
m i c h a e l
Yes, this is intentional. 'set-assoc' should behave like all other 'set'- functions returning the current version of the object, if the second argument is missing. In this case 'set-assoc' does not behave like 'replace-assoc', which can delete the element referenced.
In this case consistency with other 'set'- functions is more important than to maintain delete functionality from 'replace-assoc', which will stay until something else can take its place.
There is a lot more to say about this, but without introducing a new pair of functions (e.g. pop-ref pop-assoc) for eliminating elements in a list by search, the current situation seems to be a good compromise.
Lutz