Suppose I have a function
CL-USER> (defun trimmer (seq) "This trims seq and returns a list" (cdr (butlast seq))) TRIMMER CL-USER> (trimmer '(1 2 3 VAR1 VAR2)) (2 3 VAR1) CL-USER>
Please note that due to QUOTE, VAR1 and VAR2 are not allowed. Suppose I want to allow the characters VAR1 and VAR2 to my values - is there a standard function for this?
Do not use quoteto create a list with variables; Use instead list:
quote
list
CL-USER> (trimmer (list 1 2 3 var1 var2)) (2 3 value-of-var1)
(where value-of-var1is the value var1).
value-of-var1
var1
quote . , . , , list. backquote, .
Backquote - :
> (setq var1 4 var2 5) 5 > `(1 2 3 ,var1 ,var2) (1 2 3 4 5)
: , symbol-value, :
symbol-value
(defun interpolate-symbol-values (list) "Return a copy of LIST with symbols replaced by their symbol-value." (loop for x in list collect (if (symbolp x) (symbol-value x) x))) > (interpolate-variables '(1 2 3 var1 var2)) (1 2 3 4 5)
, . , ? , .
Source: https://habr.com/ru/post/1775692/More articles:What is LINQ to select the last item from multiple versions? - linqSplit input into multiple content-based exits? - unixway to warn developers that they are on a production site - web-applicationsAptana Studio 2 - Code Assist for JS not working - javascriptКак я могу проверить демоверсии Delphi от Sourceforge? - delphiWhy doesn't getconf recognize BUFSIZ? - cSscanf with multiline string - cWhy EM_SETMARGINS does not work under Windows 7? - user-interfaceTop left point of rotated RectangleGeometry in C # - c #Как бы вы могли написать переменную функцию строки с использованием модуля в CoffeeScript? - javascriptAll Articles