Beginners Corner - list functions

Started by didi, February 04, 2009, 09:28:28 AM

Previous topic - Next topic

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 )    ?

Jeff

#1
With the push function:



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

=====

Old programmers don\'t die. They just parse on...



http://artfulcode.net\">Artful code

didi

#2
- 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  :-)