Coverage report: /home/ellis/.stash/quicklisp/dists/quicklisp/software/alexandria-20241012-git/alexandria-1/symbols.lisp
Kind | Covered | All | % |
expression | 0 | 82 | 0.0 |
branch | 0 | 6 | 0.0 |
Key
Not instrumented
Conditionalized out
Executed
Not executed
Both branches taken
One branch taken
Neither branch taken
1
(in-package :alexandria)
3
(declaim (inline ensure-symbol))
4
(defun ensure-symbol (name &optional (package *package*))
5
"Returns a symbol with name designated by NAME, accessible in package
6
designated by PACKAGE. If symbol is not already accessible in PACKAGE, it is
7
interned there. Returns a secondary value reflecting the status of the symbol
8
in the package, which matches the secondary return value of INTERN.
12
(ensure-symbol :cons :cl) => cl:cons, :external
14
(intern (string name) package))
16
(defun maybe-intern (name package)
19
(intern name (if (eq t package) *package* package))
22
(declaim (inline format-symbol))
23
(defun format-symbol (package control &rest arguments)
24
"Constructs a string by applying ARGUMENTS to string designator CONTROL as
25
if by FORMAT within WITH-STANDARD-IO-SYNTAX, and then creates a symbol named
28
If PACKAGE is NIL, returns an uninterned symbol, if package is T, returns a
29
symbol interned in the current package, and otherwise returns a symbol
30
interned in the package designated by PACKAGE."
31
(maybe-intern (with-standard-io-syntax
32
(apply #'format nil (string control) arguments))
35
(defun make-keyword (name)
36
"Interns the string designated by NAME in the KEYWORD package."
37
(intern (string name) :keyword))
39
(defun make-gensym (name)
40
"If NAME is a non-negative integer, calls GENSYM using it. Otherwise NAME
41
must be a string designator, in which case calls GENSYM using the designated
42
string as the argument."
43
(gensym (if (typep name '(integer 0))
47
(defun make-gensym-list (length &optional (x "G"))
48
"Returns a list of LENGTH gensyms, each generated as if with a call to MAKE-GENSYM,
49
using the second (optional, defaulting to \"G\") argument."
50
(let ((g (if (typep x '(integer 0)) x (string x))))
54
(defun symbolicate (&rest things)
55
"Concatenate together the names of some strings and symbols,
56
producing a symbol in the current package."
57
(let* ((length (reduce #'+ things
58
:key (lambda (x) (length (string x)))))
59
(name (make-array length :element-type 'character)))
61
(dolist (thing things (values (intern name)))
62
(let* ((x (string thing))
64
(replace name x :start1 index)