i am new to newlisp.
section 6 of Design Elements and Patterns in newLISP
has the following:
(set 'data:data '(a b c d e f g h))
(define (change db i value)
(nth-set (db i) value))
(change data 3 999)
but db is undefined when change is called.
ERR:value expected in function nth-set : (db i)
can anyone tell me why?
question on Design Elements and Patterns in newLISP
-
- Posts: 72
- Joined: Sun Jun 11, 2006 8:02 pm
- Location: berkeley, california
- Contact:
-
- Posts: 58
- Joined: Sat Jun 10, 2006 5:34 am
It doesn't work for me either, but the book is for version 8.8.9 of newLISP and my version is 8.8.0. I presume that the code is correct for version 8.8.9.
I had to change
to
and
to
I had to change
Code: Select all
(nth-set (db i) value))
Code: Select all
(nth-set i db value))
Code: Select all
(change data 3 999)
Code: Select all
(change data:data 3 999)
-
- Posts: 2038
- Joined: Tue Nov 29, 2005 8:28 pm
- Location: latiitude 50N longitude 3W
- Contact:
Perhaps this is the change introduced in 8.8.1, so still in the Development release and release notes...
The Design Patterns document is way ahead of itself, it seems! Good for it, but confusing if that's one piece of the documentation that isn't tied to the release...
Or perhaps it isn't.implicit n-rest and slice on default lists and strings:
(set 'foo:foo '(a s d f g h j))
(2 foo) => (d f g h j)
(-3 2 foo) => (g h)
The Design Patterns document is way ahead of itself, it seems! Good for it, but confusing if that's one piece of the documentation that isn't tied to the release...