TheSwamp

Code Red => AutoLISP (Vanilla / Visual) => Topic started by: d2010 on August 04, 2021, 01:20:17 PM

Title: Convert multpiple strncat to lambda(x) of list
Post by: d2010 on August 04, 2021, 01:20:17 PM
Can you transform this block, (progn...) code to lambda?
If you lose time with big-source/s-EdCL  for re-format, then you can make a demo.lsp  with the adcl, not the edcl.
  (progn (setq adcl "")
            (setq adcl (strcat adcl  "1"))
            (setq adcl (strcat adcl  "2"))
            (setq adcl (strcat adcl  "3"))
......
            (setq adcl (strcat adcl  "9"))
            (strlen adcl)
   )

Thanks....

Code: [Select]
(progn  (sEtq edcl "" )
 (setq   edcl (strCat edcl
 "image_sliderH : slider { min_value = -1; max_value = 100; layout = horizontal ; height = 0; width = 100;}\npp_raceaf : dialog \n { label = \"CursorColor for model-space\";\n : boxed_column { \n : text { key = \"q\";label = \"Sizeof CrossHair\";alignment=center;}\n : image_sliderH {key = \"x1\";}\n }\n : boxed_row { \n : button { key=\"rosu\"; label=\"Red=Rosu\";}\n : button { key=\"galb\"; label=\"Yellow=Galben\";}\n : button { key=\"cyan\"; label=\"Cyan\";}\n : button { key=\"blue\"; label=\"Blue=albastru\";}\n"));;T915@:02820
 (setq   edcl (strCat edcl " : button { key=\"mage\"; label=\"Magenta\";}\n : button { key=\"ros2\"; label=\"Rosu2\";}\n : button { key=\"albc\"; label=\"White=Albul\";}\n : button { key=\"papi\"; label=\"Paper218\";}\n }\n : popup_list {\n label = \"pDestinationView\";\n mnemonic = \"D\";\n edit_width = 30;\n key = \"pDestination\";\n list = \"0.Default\\n1.addToModelSpace\\n2.addToLayoutDict\\n3.addToWorkSet\";\n }\n : text { key = \"1\"; label = \"You change Color for CursorHair\";alignment=left;}\n : text { key = \"2\"; label = \".......... "));;T915@:02821
 (setq   edcl (strCat edcl "activati 'SNAP' de jos\";alignment=left;}\n ok_cancel;\n}\n "))
   (strlen edcl)
  )
Title: Re: Convert multpiple strncat to lambda(x) of list
Post by: JohnK on August 04, 2021, 01:43:27 PM
No need for the "lambda (x)" construct; use apply instead.

Code - Auto/Visual Lisp: [Select]
  1. (setq listofstrings '("1" "2" "3" "4" "5" "6" "7")
  2.       adcl ""
  3.       adcl (apply 'strcat listofstrings))