I found a reference to variable $it set by setf in Introduction to newlisp book, in the chapter on strings, http://en.wikibooks.org/w/index.php?tit ... ng_strings
which doesn't exist in the manual nor works in v10.3.3.
I was about to remove the mention, but then decided to ask first in here just in case there's another way to achieve the same results. I mean to operate on the character selected by setf and use that result as the input to the same setf.
The manual only talks about $<int> and $idx
variable $it not set - updating itn book
Re: variable $it not set - updating itn book
The example in the WikiBooks introduction should be changed to:
Without the copy you get a protection violation for $it which must not be changed.
The system variable $it is mentioned in the 10.3.3 doc for setf
http://www.newlisp.org/downloads/newlis ... .html#setf
look at the last examples.
$it is also used in several other functions. For an overview of system variables see here:
http://www.newlisp.org/downloads/newlis ... em_symbols
Code: Select all
(set 'wd "cream")
;-> "cream"
> (setf (wd 0) (char (inc (char (copy $it)))))
;; or: (setf (wd 0) (char (+ (char $it) 1)))
;-> "d"
wd
;-> "dream"
The system variable $it is mentioned in the 10.3.3 doc for setf
http://www.newlisp.org/downloads/newlis ... .html#setf
look at the last examples.
$it is also used in several other functions. For an overview of system variables see here:
http://www.newlisp.org/downloads/newlis ... em_symbols
Re: variable $it not set - updating itn book
... turns out it should not give a protection error. char shouldn't pass out the reference to inc. This will be fixed.
ps: fixed for this week's development release 10.3.8 for char and other functions. A change in the WikiBook Introduction is not necessary.
ps: fixed for this week's development release 10.3.8 for char and other functions. A change in the WikiBook Introduction is not necessary.
Re: variable $it not set - updating itn book
Sorry about that Lutz, my bad. I just went for the index instead of searching and now I'm noticing that the index is for functions and that there're plenty of mentions of $it.Lutz wrote: The system variable $it is mentioned in the 10.3.3 doc
http://www.newlisp.org/downloads/newlis ... em_symbols
Should it mention the different behavior (pre and post v10.3.8) ?Lutz wrote: A change in the WikiBook Introduction is not necessary.
Re: variable $it not set - updating itn book
Perhaps we should then update the introduction with this:
and then it covers all versions.
Ps: just did the modification in WikiBooks.
Code: Select all
(setf (wd 0) (char (+ (char $it) 1)))
Ps: just did the modification in WikiBooks.
-
- Posts: 2038
- Joined: Tue Nov 29, 2005 8:28 pm
- Location: latiitude 50N longitude 3W
- Contact:
Re: variable $it not set - updating itn book
Cool to see some collaborative editing action, thanks guys. Btw, only registered users can make changes without a reviewer accepting them; I think this is because I marked the book's status as nearly completed... :) Which it never will be, I hope!