newLISP Fan Club

Forum => newLISP newS => Topic started by: didi on February 04, 2009, 09:28:28 AM

Title: Beginners Corner - list functions
Post by: didi on February 04, 2009, 09:28:28 AM
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 )    ?
Title:
Post by: Jeff on February 04, 2009, 12:38:41 PM
With the push function:



(push '("ghi" "jkl") folder 3 1)
Title:
Post by: didi on February 04, 2009, 01:00:05 PM
- 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  :-)