Beginners Corner - list functions

Notices and updates
Locked
didi
Posts: 166
Joined: Fri May 04, 2007 8:24 pm
Location: Germany

Beginners Corner - list functions

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

Jeff
Posts: 604
Joined: Sat Apr 07, 2007 2:23 pm
Location: Ohio
Contact:

Post by Jeff »

With the push function:

(push '("ghi" "jkl") folder 3 1)
Jeff
=====
Old programmers don't die. They just parse on...

Artful code

didi
Posts: 166
Joined: Fri May 04, 2007 8:24 pm
Location: Germany

Post 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 :-)

Locked