Common Lisp Programmatic Keyword

后端 未结 6 1090
我在风中等你
我在风中等你 2020-12-14 07:10

Is there a function in Common Lisp that takes a string as an argument and returns a keyword?

Example: (keyword \"foo\") -> :foo

6条回答
  •  不思量自难忘°
    2020-12-14 07:49

    In case, you can change the string to start with colon sign :

    use read-from-string directly.

    Here is another version of make-keyword:

    (defun make-keyword (name)
               (read-from-string (concatenate 'string ":" name)))
    

提交回复
热议问题