symbol.lisp 450 B

12345678910111213141516171819
  1. (import core/base (defun if get-idx))
  2. (import core/type (symbol?))
  3. (import core/list (map))
  4. (import lua/table (concat))
  5. (defun symbol->string (x)
  6. "Convert the symbol X to a string."
  7. (if (symbol? x)
  8. (get-idx x "contents")
  9. nil))
  10. (defun string->symbol (x)
  11. "Convert the string X to a symbol."
  12. { :tag "symbol" :contents x })
  13. (defun sym.. (&xs)
  14. "Concatenate all the symbols in XS."
  15. (string->symbol (concat (map symbol->string xs))))