application/octet-stream
•
969 B
•
30 lines
;;; Nujel - Copyright (C) 2020-2021 - Benjamin Vincent Schulenburg
;;; This project uses the MIT license, a copy should be included under /LICENSE
;;;
;;; Functions converting from one type to another
(defn keyword->string (kw)
"Convert a keyword into a string
kw: The input keyword
Returns the string for kw"
:cat :type-conversion
:related string->keyword
(deftest "asd" (keyword->string :asd))
(when-not (keyword? kw) (exception :type-error "(keyword->string) can only be called on keywords" kw))
(string (keyword->symbol kw)))
(defn string->keyword (kw)
"Convert a string into a keyword
kw: The input string
Returns the keyword for kw"
:cat :type-conversion
:related keyword->string
(deftest :asd (string->keyword "asd"))
(when-not (string? kw) (exception :type-error "(string->keyword) can only be called on strings" kw))
(symbol->keyword (string->symbol kw)))