2020-09-01 14:44:18 +02:00
|
|
|
;;; symbol.el --- Library for working with symbols -*- lexical-binding: t -*-
|
2020-09-01 00:28:47 +02:00
|
|
|
|
2019-10-09 13:13:56 +02:00
|
|
|
;; Author: William Carroll <wpcarro@gmail.com>
|
2020-09-01 00:28:47 +02:00
|
|
|
;; Version: 0.0.1
|
|
|
|
;; Package-Requires: ((emacs "24"))
|
2019-10-09 13:13:56 +02:00
|
|
|
|
|
|
|
;;; Commentary:
|
|
|
|
;; Library for working with symbols.
|
|
|
|
|
|
|
|
;;; Code:
|
|
|
|
|
2020-09-01 00:28:47 +02:00
|
|
|
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
|
2022-07-30 19:43:06 +02:00
|
|
|
;; Library
|
2020-09-01 00:28:47 +02:00
|
|
|
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
|
2019-10-09 13:13:56 +02:00
|
|
|
|
2022-07-30 19:43:06 +02:00
|
|
|
(defun symbol-to-string (symbol)
|
|
|
|
"Map `SYMBOL' into a string."
|
|
|
|
(symbol-name symbol))
|
2019-10-09 13:13:56 +02:00
|
|
|
|
2022-07-30 19:43:06 +02:00
|
|
|
(defun symbol-from-string (string)
|
|
|
|
"Map `STRING' into a symbol."
|
|
|
|
(intern string))
|
2020-09-01 00:28:47 +02:00
|
|
|
|
2022-07-30 19:43:06 +02:00
|
|
|
(defun symbol-as-string (f x)
|
|
|
|
"Treat the symbol, X, as a string while applying F to it.
|
2019-10-09 13:13:56 +02:00
|
|
|
Coerce back to a symbol on the way out."
|
2022-07-30 19:43:06 +02:00
|
|
|
(symbol-from-string (funcall f (symbol-to-string x))))
|
|
|
|
|
|
|
|
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
|
|
|
|
;; Predicates
|
|
|
|
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
|
2019-10-09 13:13:56 +02:00
|
|
|
|
2020-09-01 00:28:47 +02:00
|
|
|
(defun symbol-instance? (x)
|
2019-10-09 13:13:56 +02:00
|
|
|
"Return t if X is a symbol."
|
|
|
|
(symbolp x))
|
|
|
|
|
|
|
|
(provide 'symbol)
|
|
|
|
;;; symbol.el ends here
|