Bill Tillman 发表于 2022-7-5 17:33:50

What's With QUOTE in the

Some other developers here are sending some variables with values into the project I'm working on from C#.NET code. It looks simple but something I did not expect is happening.
 

(setq the_array '('(1 "R" 0 1) '(1 "L" 0 1) '(0 "L" 0 1) '(0 "R" 0 1) '(1 "R" 1 1) '(1 "L" 1 1)))If I examine the value of this variable called the_array it will show this:
I wasn't expecting the word "QUOTE" to show up in the array. I'm going to parse this text to do some drawing tasks so just deleting this text from the string I think I can handle. I'd like to know why it shows up in the first place. I think this guy's attempt to form a list of lists is not quite right. 
By removing the leading apostrophes I able to get the "QUOTE" text out of the value, but I have to admit I wasn't expecting this to happen. Nor were the other developers. And to be honest, I don't really need the " " around the text items in this either. So I'm going to change their input slightly to make it easier to parse this list of lists.

Lee Mac 发表于 2022-7-5 18:44:15

The apostrophe or single quote is a shorthand equivalent for the AutoLISP quote function, therefore, by quoting a list which contains single quotes, you will see the AutoLISP quote function appear as the quoted list is a literal expression and hence is not evaluated. This is no different to quoting a list containing any other AutoLISP function or symbol. Since the entire list is already quoted as a literal expression, the quotes within the list are redundant - see here for more information.
页: [1]
查看完整版本: What's With QUOTE in the