TheSwamp
Code Red => AutoLISP (Vanilla / Visual) => Topic started by: vincent.r on September 05, 2017, 02:36:54 AM
-
I am newbie to autolisp, I am trying to add a string "MVTTPL-101-DB-11_1" to a predefined list i.e. (setq shrirfi '(fnames)).
I have googled this but could not get solution ? Can anybody help ?
-
>> (setq shrirfi '(fnames))
What is fnames? string, list, ...?
-
its a string in a list. want to some more strings next to fnames.
-
my mistake. actually it is (setq shrirfi '("fnames")).
-
Maybe:
Comando: (setq shrirfi '("fnames"))
("fnames")
Comando: (setq shrirfi (cons "MVTTPL-101-DB-11_1" shrirfi))
("MVTTPL-101-DB-11_1" "fnames")
Comando: !shrirfi
("MVTTPL-101-DB-11_1" "fnames")
-
It works great. Thanks Marc'Antonio Alessi. I was trying with append function, now I will use reverse.
Thanks again for your quick reply.
-
...append is slower
:-)
-
If you don't want to reverse your list just use append as you mentioned: (append shrirfi '("MVTTPL-101-DB-11_1"))