tag:blogger.com,1999:blog-5894839.post5648200966262908519..comments2023-10-03T18:59:20.162+02:00Comments on Kazimir Majorinc's Blog (currently not in use): Starting with Newlisp.Kazimir Majorinchttp://www.blogger.com/profile/03407339997157446200noreply@blogger.comBlogger3125tag:blogger.com,1999:blog-5894839.post-62470434642851382142008-05-26T09:31:00.000+02:002008-05-26T09:31:00.000+02:00Great Topics! ;-)Great Topics! ;-)Anonymousnoreply@blogger.comtag:blogger.com,1999:blog-5894839.post-35921599705078574292008-05-09T18:33:00.000+02:002008-05-09T18:33:00.000+02:00..previous commentator already said what I was goi.....previous commentator already said what I was going to add ;))<BR/><BR/>[1] I.e. if a symbol is declared as belonging to some "context", then Newlisp keeps it as a static var, and its use in other expressions will automatically reuse "the same parts".<BR/><BR/>One can freely copy from a context-defined symbols. For example if I have a string a:string, then, say, some function <BR/><BR/>(reverse (string a:string)) <BR/><BR/>which on the surface uses redundant cast into string of what is already a string in fact creates a COPY of the original a:string, and if this hypothetical reverse is destructive, it won't affect the original a:string.<BR/><BR/>No such trick - and you'll be changing the original.<BR/><BR/>[2] "Contexts" are in my view a nice and powerful instrument. Actually, each "context" is a "hash", to use a Perl term (a red-black tree), and can even get back its symbols in alphabetical order, which is sometimes nice for kind-of built-in sorting without extra overhead.<BR/>(see the "dotree" operator)<BR/><BR/>;))Anonymousnoreply@blogger.comtag:blogger.com,1999:blog-5894839.post-1698197534401949362008-05-09T15:36:00.000+02:002008-05-09T15:36:00.000+02:00"... and symbols can be used as references of data..."... and symbols can be used as references of data structures"<BR/><BR/>Yes, and this is how you can do it in 9.3.0. A trivial example how to do reference passing:<BR/><BR/>(define foo:data '(a b c d e f))<BR/><BR/>(define (pop-last aList)<BR/> (pop aList:data -1))<BR/><BR/>(pop-last foo) => f<BR/><BR/>foo:data => (a b c d e)<BR/><BR/>Additionally in development version 9.3.11 and after you can do:<BR/><BR/>(define foo:foo '(a b c d e f))<BR/><BR/>(define (pop-last aList)<BR/> (pop aList -1))<BR/><BR/>(pop-last foo) => f<BR/><BR/>foo:foo => (a b c d e)<BR/><BR/>foo:foo is called the "default functor" (usage of the namespace name "foo" defaults to the symbol in it of the same name "foo:foo").Anonymousnoreply@blogger.com