List indexing

Started by didi, January 09, 2012, 11:06:04 AM

Previous topic - Next topic

didi

; implicit indexing from "Code Patterns"



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



(L 2 2 1) → f

(L 2 2)   → (e f)



Is there a reverse function to get the vector of an  element in a nested list ?

Is it right, that the  find function principally does this,  but only in the highest level ?



For example

(find 'a L ) -> 0

(find 'b L ) -> 1

(find 'c L ) -> nil ?

johu

#1
from http://www.newlisp.org/downloads/newlisp_manual.html#find">newLISP Manual and Reference


QuoteTo find expressions in nested or multidimensional lists, use the ref and ref-all functions.


Then,
> (set 'L '(a b (c d (e f) g) h i))
(a b (c d (e f) g) h i)
> (ref 'b L)
(1)
> (ref 'c L)
(2 0)
> (ref 'f L)
(2 2 1)
>

didi

#2
Super,  thankyou !