Version 8.8.8 was just released
http://www.newlisp.org/downloads/development/CHANGES-8.8.1-8.txt
http://www.newlisp.org/downloads/development/
8.8.8
eliminates several cell leaks in unify
'pop' can be used on strings (pop str [pos] [len]) pos can be negative
'push' can be used on strings (push str [pos]) pos can be negative
'push' now will only do list mode when lst is list or nil:
(push new lst) lst has to be list or nil, previous to string mode of push
any existing datatype non-list was initializeed to () now only nil is allowed
system var $idx contains the offset in dolist:
(dolist (e '(a b c d e)) (println $idx "->" e))
0->a
1->b etc.
indexing mode of 'args' now works with multiple indices, i.e (args 3 -1)
and is much faster
implicit indexing syntax now allowed in 'nth-set' and 'set-nth':
(set 'd '(a b c d e f g))
(nth-set (d 3) 99) => d
d => (a b c 99 e f g)
or with default functor:
(set 'db:db '(a b c d e f g))
(nth-set (db -1) 99) => g
db:db => (a b c d e f 99)
This also works for strings and arrays
many fixes/changes/additions in the manual and reference
Sorry Lutz, I had to post it already, to quote on 8.8.8 ;-)
Looks like your reading my mind somehow.. I always missed the
option to count the index of a dolist, so the $idx is a great introduction! ;-)
Push and pop on strings, very nice..
Thanks!, Norman.
Btw..can dotimes use the $idx too ?
Fine changes!
Can I suggest a function that will do nondestructive append to a list?
I.e. something like this:
(define (append-one lst i) (append lst (list i)))
In my practice it is used too frequent...
...moreover we already have (cons) that do similar, but in different order...
It would work like 'cons' but from right to left, and we could call it 'tcons' like tail cons or 'rcons' like reverse cons or 'apcons' like append-cons or something entirely different?
(tcons) => ()
(tcons 'a 'b) => (a b)
(tcons '(a b c) 'd) => (a b c d)
(tcons '(a b c) '(d e) => (a b c (d e))
My first pick was 'acons' (like acos, asin, atan), but unfortunately older LISPs defines 'acons' already as an operation on association lists:
(define (acons key value alist) (cons (cons key value) alist))
> (acons 'a 'b '())
((a b))
> (acons 'x 'y '((a b)))
((x y) (a b))
>
So it would have to be another name, 'append-one' is very descriptive but seems too long to me, any body else with any suggestions, and is this really needed at all?
Lutz
"cons" is from "construct", so call it "coup" from "couple" ;-)
In fact I don't bother with name - only with (append ... (list ...))
"attach"?
Lutz,
In the manual in the entry for the Unify function you need to change the word "physist" to "physicist".
Quote from: "Jeremy"
In the manual in the entry for the Unify function you need to change the word "physist" to "physicist".
Done :-) Thanks, Jeremy!
m i c h a e l
Found some more.
Under the entry for DOLIST
change "duwing" to during"
change "bold fgace" to "bold face"
Quote from: "Jeremy"
change "duwing" to during"
change "bold fgace" to "bold face"
Done and done. Thanks again!
m i c h a e l
Some good news from the Tru64Unix world regarding this release. :-)
1) newLisp compiles both on Tru64Unix 4.0f and 5.1B without problems.
2) newLisp survives all tests both on Tru64Unix 4.0f and 5.1B.
One remark about the Makefile though. It appears that the '-O2' optimization has a different meaning for the Compaq C-compiler. The binary becomes pretty large and newLisp runs slow.
Compiled with '-O3' however, the binary is smaller and runs the fastest of all optimizations. So Lutz, could you change the optimization flag in the 'makefile_tru64' from -O2 to -O3 in the 8.9 release??
Thanks,
Peter
Thanks for the good news. I changed to -O3 in makefile_true64
Lutz
The changes to 'nth-set' deliver an interesting observation:
newLISP v.8.8.8 on linux, execute 'newlisp -h' for more info.
> (set 'a "text")
"text"
> (nth-set (+ 1 2) a " ")
symbol is protected in function nth-set : +
>
It seems that the second argument to 'nth-set' cannot be a function...? This used to work in previous versions of newLisp.
Peter
It is assuming the new alternative implicit indexing syntax in 'nth-set/set-nth'. This will be fixed in 8.8.9 by reverting to old syntax when the list expression starts with a function/operator.
Lutz
Quote from: "Lutz"
It would work like 'cons' but from right to left, and we could call it 'tcons' like tail cons or 'rcons' like reverse cons or 'apcons' like append-cons or something entirely different?
...
So it would have to be another name, 'append-one' is very descriptive but seems too long to me, any body else with any suggestions, and is this really needed at all?
I saw it called 'snoc' in some Haskell paper I read a few years back. Get it? snoc? Har-dee har-har. :-) It's also pronouncable.
Yes, I also thought about 'snoc', but somehow it feels weird, perhaps we should just hijack 'acons' ;)
Lutz