Page 1 of 1

Beginners Corner - list functions

Posted: Wed Feb 04, 2009 5:28 pm
by didi
I can't find the solution to this simple question, maybe you can help me.

This is my target :
( "myfolder" "me" 55 ( ( "abc" "def" ) ( "ghi" "jkl" )))

This is my start point :
(set 'SN:folder '("myFolder" "me" 55 '( ( "abc" "def" ) )))

( set 'note '( "ghi" "jkl" ))

With 'setf' i can change an existing element :
( setf ( folder 3 0 ) note ))

But how can i push a new 'note' to the place ( folder 3 1 ) ?

Posted: Wed Feb 04, 2009 8:38 pm
by Jeff
With the push function:

(push '("ghi" "jkl") folder 3 1)

Posted: Wed Feb 04, 2009 9:00 pm
by didi
- and after your hint i just found out that, if i don't know the index and i want to push it simply on the end i can use :

(push '("ghi" "jkl") folder 3 -1)

Thanks Jeff :-)