newLISP Fan Club

Forum => newLISP newS => Topic started by: newdep on May 28, 2006, 10:21:54 PM

Title: development version newLISP 8.8.8
Post by: newdep on May 28, 2006, 10:21:54 PM
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
Title:
Post by: newdep on May 28, 2006, 10:23:44 PM
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.
Title:
Post by: newdep on May 28, 2006, 10:28:55 PM
Btw..can dotimes use the $idx too ?
Title:
Post by: Dmi on May 29, 2006, 04:38:09 AM
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...
Title:
Post by: Lutz on May 29, 2006, 01:09:08 PM
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
Title:
Post by: Dmi on May 29, 2006, 01:48:44 PM
"cons" is from "construct", so call it "coup" from "couple" ;-)

In fact I don't bother with name - only with (append ... (list ...))
Title:
Post by: cormullion on May 29, 2006, 02:50:19 PM
"attach"?
Title: Manual Correction
Post by: Jeremy Dunn on May 30, 2006, 12:45:05 PM
Lutz,



In the manual in the entry for the Unify function you need to change the word "physist" to "physicist".
Title:
Post by: m i c h a e l on May 30, 2006, 06:33:31 PM
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
Title:
Post by: Jeremy Dunn on May 31, 2006, 12:51:11 PM
Found some more.



Under the entry for DOLIST



change "duwing" to during"

change "bold fgace" to "bold face"
Title:
Post by: m i c h a e l on May 31, 2006, 01:00:40 PM
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
Title:
Post by: pjot on May 31, 2006, 02:02:44 PM
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
Title:
Post by: Lutz on May 31, 2006, 02:06:45 PM
Thanks for the good news. I changed to -O3 in makefile_true64



Lutz
Title:
Post by: pjot on June 01, 2006, 02:33:55 PM
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
Title:
Post by: Lutz on June 01, 2006, 04:35:41 PM
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
Title:
Post by: rickyboy on June 05, 2006, 01:14:45 PM
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.
Title:
Post by: Lutz on June 05, 2006, 04:39:28 PM
Yes, I also thought about 'snoc', but somehow it feels weird, perhaps we should just hijack 'acons' ;)



Lutz