newLISP Fan Club

Forum => newLISP newS => Topic started by: eddier on March 18, 2005, 07:59:26 AM

Title: implicit indexing
Post by: eddier on March 18, 2005, 07:59:26 AM
Neat! I've not seen anything quite like this before. The first thing after a non-quoted list is not interpreted as a function.

> (setq a '((1 2) 3))
((1 2) 3)
> (a 1)
3
>


Thyping (a 1 2) is as easy to type as a[1][2] and maybe as easy to read?



Eddie
Title:
Post by: Lutz on March 18, 2005, 08:27:51 AM
... and it also works with indices in vectors (forgot to mention this in the changes notes, but its in the manual):



(set 'L '(a b (c d (e f) g)))

(L 2 2 0 ) => e

(set 'vec '(2 2 0))

(L vec) => e


This way 'push', 'pop' and 'ref' fit all together with implicit indexing



Lutz