Jump to content

Recommended Posts

Posted

Hi.

 

I need to assign the name to a variable, but taking the name of an element from a LIST.

 

Example:

Command: (setq TEMPORAL '*Blocks*)

*BLOCKS*

 

Command: (set TEMPORAL 250)

250

 

Command: !TEMPORAL

*BLOCKS*

 

Command: !*blocks*

250

 

 

Until here Ok.

 

 

Now it is required that the name of the variable is taken from an element in a LIST:

 

(setq x1 (list "*blocks*" "*layers"))

("*blocks*" "*layers")

 

Command: (set TEMPORAL (nth 0 x1))

"*blocks*"

 

I do not require the value "*blocks*" to be assigned to the TEMPORAL symbol, but symbol *BLOCKS* is assigned.

 

 

How can this be done?

 

 

Regards.

gerardo2m.

Posted

Either:

(setq x1 '(*blocks* *layers*))
(setq TEMPORAL (car x1))
(set TEMPORAL 250)

Or:

(setq x1 (list '*blocks* '*layers*))
(setq TEMPORAL (car x1))
(set TEMPORAL 250)

Or:

(setq x1 (list "*blocks*" "*layers*"))
(setq TEMPORAL (read (car x1)))
(set TEMPORAL 250)

Looks like a homework assignment to me. :whistle:

Posted

I aprecciate you support Lee, thanks.

 

It isn't homework, I was stuck with that part of the code to use MAPCAR and LAMBDA for extract info of drawing's Colecctions.:oops:

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