newLISP Fan Club

Forum => newLISP in the real world => Topic started by: newdep on February 09, 2007, 04:56:50 AM

Title: extending nested lists
Post by: newdep on February 09, 2007, 04:56:50 AM
Hello Lutz,



How difficult is it to extend the current depth of 16 to 256/512 for nested lists?

(..besides the difficulty, it probbaly would be a speed impact...)



Just currious..



regards, Norman.
Title:
Post by: Lutz on February 09, 2007, 05:53:19 AM
There is no limit in nesting anymore for lists. The limit of 16 which existed for some functions in 9.0 is gone. Most of the index stuff was reworked in 9.0.11. Whatever you memory gives can be done:



nesting of lists can be as deep as you want:


> (set 'L '((((((((((((((((((((((((((((((((((((x)))))))))))))))))))))))))))))))))))))
((((((((((((((((((((((((((((((((((((x))))))))))))))))))))))))))))))))))))
> (set 'V (ref 'x L))
(0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0
 0 0 0 0)
> (L V)
x
> (nth (L V))
x
> (nth-set (L V) 99)
x
> L
((((((((((((((((((((((((((((((((((((99))))))))))))))))))))))))))))))))))))
> (nth 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 L)
99
> (pop L V)
99
> L
(((((((((((((((((((((((((((((((((((())))))))))))))))))))))))))))))))))))
>


Lutz



ps: newLISP is the only LISP with this kind of support for indexed lists, other LISPS have to write complex recursive algorithms to achieve this.
Title:
Post by: newdep on February 09, 2007, 05:59:20 AM
HA! Fantastic !  ;-)