Feature complete for 9.3 release on January 15th.
Files and changes notes: http://newlisp.org/downloads/development/
Lutz
development release newLISP v.9.2.12
-
- Posts: 2038
- Joined: Tue Nov 29, 2005 8:28 pm
- Location: latiitude 50N longitude 3W
- Contact:
Thanks Lutz!
Yes, I'm now finding a few 'list index out of bounds' errors in my code - such as in my first effort at a tokenizer (http://unbalanced-parentheses.nfshost.c ... er.lsp.txt) !
A virtual beer token to anyone who can find the out of bounds list index!
(I've always claimed to be a beginner, so it's good that newLISP 9.3 is picking up more of my beginner's errors than before...!)
Yes, I'm now finding a few 'list index out of bounds' errors in my code - such as in my first effort at a tokenizer (http://unbalanced-parentheses.nfshost.c ... er.lsp.txt) !
A virtual beer token to anyone who can find the out of bounds list index!
(I've always claimed to be a beginner, so it's good that newLISP 9.3 is picking up more of my beginner's errors than before...!)
Lutz,
Could "list index out of bounds" be changed into 'nil or an empty list?
This error message does not feel right in the newlisp context.
Lots of functions do return 'nil when nothing found..
so should indexes on lists. That makes programming more logical too.
...but thats my view...
Btw.. (10 '( 1 2 3)) still returns '().
Norman.
Could "list index out of bounds" be changed into 'nil or an empty list?
This error message does not feel right in the newlisp context.
Lots of functions do return 'nil when nothing found..
so should indexes on lists. That makes programming more logical too.
...but thats my view...
Btw.. (10 '( 1 2 3)) still returns '().
Norman.
-- (define? (Cornflakes))
It seems that I found a bug: 'randomize' on 2-element list doesn't randomize it. List is always reversed, mo matter how much times do you call the function.
Another related bug in documentation: in description of 'rand' function it said "When 0 (zero) is passed, the internal random generator is initialized using the current value returned by the time function". But 'time' is of no use here! Probably 'time-of-day' or 'date-value'?
Code: Select all
> (randomize '(1 2))
(2 1)
> (randomize '(1 2))
(2 1)
> (randomize '(1 2))
(2 1)
With newLISP you can grow your lists from the right side!
This way you cannot distinguish between ('(a b c) 3) and ('(a b c nil) 3)newdep wrote:Could "list index out of bounds" be changed into 'nil or an empty list?
Python does it exactly this way.newdep wrote:Btw.. (10 '( 1 2 3)) still returns '().
With newLISP you can grow your lists from the right side!
This is intended behavior, 'randomize' keeps trying until a different sequence is found. Pass the extra parameter 'true' to force true randomization.
Lutz
ps: this is also described in the manual: http://newlisp.org/downloads/newlisp_ma ... #randomize
Code: Select all
> (randomize '(1 2) true)
(2 1)
> (randomize '(1 2) true)
(1 2)
> (randomize '(1 2) true)
(2 1)
> (randomize '(1 2) true)
(2 1)
> (randomize '(1 2) true)
(2 1)
> (randomize '(1 2) true)
(2 1)
> (randomize '(1 2) true)
(1 2)
>
ps: this is also described in the manual: http://newlisp.org/downloads/newlisp_ma ... #randomize
-
- Posts: 2038
- Joined: Tue Nov 29, 2005 8:28 pm
- Location: latiitude 50N longitude 3W
- Contact:
I've found my bug, so I'm going to drink the beer myself... :)
should have been
I have no excuse, and it's an ugly fix anyway... :) Still, you're lucky I don't do this for a living!
Code: Select all
(for (p 0 (length result))
Code: Select all
(for (p 0 (- (length result) 2))