newLISP Fan Club

Forum => newLISP newS => Topic started by: Lutz on January 14, 2008, 12:43:53 PM

Title: development release newLISP 9.2.16
Post by: Lutz on January 14, 2008, 12:43:53 PM
More bug-fixes for the 9.3 release on February 1st.



Files and changes notes: http://newlisp.org/downloads/development/  



Lutz
Title:
Post by: m i c h a e l on January 14, 2008, 04:35:40 PM
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
Title:
Post by: Lutz on January 15, 2008, 05:05:38 AM
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