RepCad Posted April 30, 2021 Posted April 30, 2021 Hi all, I want to append an item to last item in a list, like this : lst ((x1 y1) (x2 y2) (x3 y3)) and after appending z3 to last list in lst >> lst ((x1 y1) (x2 y2) (x3 y3 z3)) Can someone tell me how I can perform it? Quote
rlx Posted April 30, 2021 Posted April 30, 2021 (edited) (subst (append (last lst) (list 'z3)) (last lst) lst) (reverse (cons (append (car (reverse lst)) (list 'z3)) (cdr (reverse lst)))) Edited April 30, 2021 by rlx 1 Quote
Lee Mac Posted May 2, 2021 Posted May 2, 2021 One more for fun - (reverse (cons (reverse (cons 'z3 (reverse (last lst)))) (cdr (reverse lst)))) 1 Quote
X11start Posted May 3, 2021 Posted May 3, 2021 Lee, you remind me Steve Wozniak: his greatest gift has always been to be able to create electronic circuits (Apple), with the n. minimum of components! 1 Quote
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.