Author Topic: trying to understand the difference  (Read 1504 times)

0 Members and 1 Guest are viewing this topic.

cadman6735

  • Guest
trying to understand the difference
« on: May 14, 2013, 02:42:50 PM »
What is the difference?

Code: [Select]
(ssget "x" '((2 . "BLOCKNAME")))   ;works
(ssget “x” (list  (cons 2 “BLOCKNAME”)))    ;works

Code: [Select]
(setq *value* "BLOCKNAME")

(ssget "x" '((2 . *value*)))   ;does not work   <------  why does this not accept variables?
(ssget “x” (list  (cons 2 *value*)))    ;works

Thanks

dgorsman

  • Water Moccasin
  • Posts: 2437
Re: trying to understand the difference
« Reply #1 on: May 14, 2013, 03:13:31 PM »
The single quote is essentially saying "use this as is", so it is literally ((2 . *value*))) not the value you are trying to pass.  If you want to dynamically change the condtions, you will need to manually construct the list with calls to (list ...) and (cons ...).
If you are going to fly by the seat of your pants, expect friction burns.

try {GreatPower;}
   catch (notResponsible)
      {NextTime(PlanAhead);}
   finally
      {MasterBasics;}

cadman6735

  • Guest
Re: trying to understand the difference
« Reply #2 on: May 14, 2013, 03:18:17 PM »
Thank you

Tharwat

  • Swamp Rat
  • Posts: 710
  • Hypersensitive
Re: trying to understand the difference
« Reply #3 on: May 14, 2013, 03:19:45 PM »
No evaluation or expression after the quote symbol ( ' ) in other words , it is a dummy expression or static one .
Hope this helps .

Lee Mac

  • Seagull
  • Posts: 12914
  • London, England
Re: trying to understand the difference
« Reply #4 on: May 14, 2013, 03:46:49 PM »
Maybe this explanation will also shed some light on the topic:

http://www.cadtutor.net/forum/showthread.php?75708&p=513602&viewfull=1#post513602

cadman6735

  • Guest
Re: trying to understand the difference
« Reply #5 on: May 14, 2013, 04:59:48 PM »
Yes, I understand now,
Thank you all...

cadman6735

  • Guest
Re: trying to understand the difference
« Reply #6 on: May 14, 2013, 05:09:24 PM »
lee, your link, very informative and easy to understand... thanks

Lee Mac

  • Seagull
  • Posts: 12914
  • London, England
Re: trying to understand the difference
« Reply #7 on: May 14, 2013, 05:26:38 PM »
lee, your link, very informative and easy to understand... thanks

Excellent, thanks  8-)