Author Topic: List Creation from Variables  (Read 1425 times)

0 Members and 1 Guest are viewing this topic.

RGUS

  • Newt
  • Posts: 106
List Creation from Variables
« on: August 03, 2018, 12:46:28 AM »
Hi,
I'm obviously not very good at list handling because I just don't know how to get the format right for the creating this list.

I've got this:

(setvar "dimscale" 100)
(setq tag0 "A3-SCALE")
(setq value0 (strcat "1:" (rtos (getvar "dimscale"))))
 
(setq lst  '((list tag0 value0)
            ("tag1" "value1")
      )
)

It returns:
((list TAG0 VALUE0) ("tag1" "value1"))

I'd like it to return:
(("A3-SCALE" "1:100") ("tag1" "value1"))
complete with all the braces in the right place.

Is this not possible or maybe I'm simpler than I thought?
Thanks for any help.


kpblc

  • Bull Frog
  • Posts: 396
Re: List Creation from Variables
« Reply #1 on: August 03, 2018, 01:08:38 AM »
Code - Auto/Visual Lisp: [Select]
  1. (setq lst  (list (list tag0 value0) '("tag1" "value1")))
Sorry for my English.

RGUS

  • Newt
  • Posts: 106
Re: List Creation from Variables
« Reply #2 on: August 03, 2018, 01:28:30 AM »
Code - Auto/Visual Lisp: [Select]
  1. (setq lst  (list (list tag0 value0) '("tag1" "value1")))

Thanks so much, I knew it was a mixture of "list" and "'" that would make it work.
 

tombu

  • Bull Frog
  • Posts: 288
  • ByLayer=>Not0
Re: List Creation from Variables
« Reply #3 on: August 03, 2018, 07:22:11 AM »
Good explanation by Lee Mac: http://www.lee-mac.com/quote.html
Tom Beauford P.S.M.
Leon County FL Public Works - Windows 7 64 bit AutoCAD Civil 3D