Jump to content

APPEND Issue


Bill Tillman

Recommended Posts

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

Link to comment
Share on other sites

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.

Link to comment
Share on other sites

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.

Guest
Unfortunately, your content contains terms that we do not allow. Please edit your content to remove the highlighted words below.
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...