Bill Tillman Posted December 14, 2018 Share Posted December 14, 2018 I'm trying to use a simple code to build a list as I go through a REPEAT function. The variable for the list is nil when the REPEAT starts and that's where my problem seems to be. ... (setq aa '( ("Extrusions" 3) ("Hardware" 6) ("Steel" 1) ("Viewports" 252) ) ) (setq al (length aa)) (repeat al (append a '(car (car aa))) When the APPEND line runs it crashes ??? Quote Link to comment Share on other sites More sharing options...
marko_ribar Posted December 14, 2018 Share Posted December 14, 2018 You are not doing anything with append line... You should try with : (repeat al (setq a (append a (list (car (car aa))))) (setq aa (cdr aa)) ) Or alternatively if you want to preserve aa : (setq k -1) (repeat al (setq a (append a (list (car (nth (setq k (1+ k)) aa))))) ) Either way you should (setq a ... ) in order to get something after evaluation... M.R. Quote Link to comment Share on other sites More sharing options...
Bill Tillman Posted December 14, 2018 Author Share Posted December 14, 2018 Thanks. That (setq took care of it nicely. Quote Link to comment Share on other sites More sharing options...
Tharwat Posted December 14, 2018 Share Posted December 14, 2018 Or this if you are searching for the return regardless of the use of any other function. (mapcar 'car aa) Quote Link to comment Share on other sites More sharing options...
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.