The nsymbols Reference Manual

This is the nsymbols Reference Manual, version 0.3.0, generated automatically by Declt version 4.0 beta 2 "William Riker" on Wed Mar 15 07:07:22 2023 GMT+0.

Table of Contents


1 Introduction


2 Systems

The main system appears first, followed by any subsystem dependency.


2.1 nsymbols

A set of convenience functions to list class, variable, function, and other symbols.

Author

Atlas Engineer LLC

Home Page

https://github.com/atlas-engineer/nsymbols

License

BSD-3 Clause

Version

0.3.0

Source

nsymbols.asd.

Child Components

3 Files

Files are sorted by type and then listed depth-first from the systems components trees.


3.1 Lisp


3.1.1 nsymbols/nsymbols.asd

Source

nsymbols.asd.

Parent Component

nsymbols (system).

ASDF Systems

nsymbols.


3.1.2 nsymbols/package.lisp

Source

nsymbols.asd.

Parent Component

nsymbols (system).

Packages

nsymbols.


3.1.3 nsymbols/nsymbols.lisp

Dependency

package.lisp (file).

Source

nsymbols.asd.

Parent Component

nsymbols (system).

Public Interface
Internals

4 Packages

Packages are listed by definition order.


4.1 nsymbols

‘nsymbols’ exports functions and variables to filter symbols in packages.

There are functions directly listing symbols:
- ‘package-symbols’ (the one all the other functions build upon).
- ‘package-variables’.
- ‘package-functions’.
- ‘package-generic-functions’.
- ‘package-macros’.
- ‘package-classes’.
- ‘package-structures’.

And there are respective CL types for those symbols to check symbol validity: - ‘variable-symbol’.
- ‘function-symbol’.
- ‘generic-function-symbol’.
- ‘macro-symbol’.
- ‘class-symbol’.
- ‘structure-symbol’.

These types use the predicates to check symbol type:
- ‘variable-symbol-p’.
- ‘function-symbol-p’.
- ‘generic-function-symbol-p’.
- ‘macro-symbol-p’.
- ‘class-symbol-p’.
- ‘structure-symbol-p’.

Adding to the regular package-* listings, there is a "nsymbols/star"
ASDF system with:
- ‘package-functions*’.
- ‘package-generic-functions*’.
- ‘package-methods*’.
- ‘package-classes*’.
- ‘package-structures*’
- ‘package-slots*’
which return the respective function, class, method etc. objects
instead of symbols for those.

As you can see, those are pretty regular. That’s due to using ‘define-symbol-type’ that saves a lot of work in defining new types of symbols. More so: it allows assigning a name to a symbol type, so that you can, for example, refer to this type in ‘package-symbols’ or ‘resolve-symbol’.

;; Define an absurd type of symbols starting with A. (nsymbols:define-symbol-type starts-with-a ()
(char-equal #a (elt (symbol-name nsymbols:%symbol%) 0)))

;; Use it
(nsymbols:package-starts-with-as :nsymbols)
;; => (NSYMBOLS::ALL-PACKAGES)

Now, ‘resolve-symbol’ is a convenient symbol search function that searches for a symbol by name in given packages, based on its type and visibility. Which allows you to fine-tune the search to whatever set
of symbols you want:

;; Search any type of HELLO symbol in ‘*default-packages*’: (nsymbols:resolve-symbol :hello :any)

;; Search any type of * in CL:
(nsymbols:resolve-symbol :* :any :cl)

;; Search function named * in CL:
(nsymbols:resolve-symbol :* :function :cl)

;; Search a custom type defined earlier:
(nsymbols:resolve-symbol "ALL-PACKAGES" :starts-with-a :nsymbols)

Source

package.lisp.

Use List

common-lisp.

Public Interface
Internals

5 Definitions

Definitions are sorted by export status, category, package, and then by lexicographic order.


5.1 Public Interface


5.1.1 Special variables

Special Variable: %symbol%

Special variable to bind symbols during type-checking to.

Package

nsymbols.

Source

nsymbols.lisp.

Special Variable: *default-packages*

Package designator or a list of package designators for ‘resolve-symbol’ to use by default.

Package

nsymbols.

Source

nsymbols.lisp.


5.1.2 Macros

Macro: define-symbol-type (name (&rest parents) &body predicate-body)

Define a new symbol type.

Generates several functions and exports them out of :nsymbols package for convenience (%NAME% is substituted with NAME):
- %NAME%-SYMBOL-P – a predicate checking the symbol for being of this type. - %NAME%-SYMBOL – a type to check the symbol.
- PACKAGE-%NAME%S – a configurable package symbol listing.

In other words, it generates VARIABLE-SYMBOL-P, VARIABLE-SYMBOL, and PACKAGE-VARIABLES for VARIABLE symbol type.

NAME is a symbol designator to reference this symbol type in ‘resolve-symbol’, or a list of two symbol designators:
- First symbol designator is the symbol type name.
- Second designator is its plural version, if atypical.

PREDICATE-BODY is the body of the boolean-returning function to find
the required symbols among the list of other symbols. You can refer to the symbol being checked with a special variable %SYMBOL%.

Package

nsymbols.

Source

nsymbols.lisp.


5.1.3 Ordinary functions

Function: class-symbol-p (%symbol%)
Package

nsymbols.

Source

nsymbols.lisp.

Function: filter-symbols (visibility symbols)
Package

nsymbols.

Source

nsymbols.lisp.

Function: function-symbol-p (%symbol%)
Package

nsymbols.

Source

nsymbols.lisp.

Function: generic-function-symbol-p (%symbol%)
Package

nsymbols.

Source

nsymbols.lisp.

Function: macro-symbol-p (%symbol%)
Package

nsymbols.

Source

nsymbols.lisp.

Function: package-classes (packages &optional visibility)
Package

nsymbols.

Source

nsymbols.lisp.

Function: package-functions (packages &optional visibility)
Package

nsymbols.

Source

nsymbols.lisp.

Function: package-generic-functions (packages &optional visibility)
Package

nsymbols.

Source

nsymbols.lisp.

Function: package-macros (packages &optional visibility)
Package

nsymbols.

Source

nsymbols.lisp.

Function: package-structures (packages &optional visibility)
Package

nsymbols.

Source

nsymbols.lisp.

Function: package-symbols (packages &key visibility type)

Return the list of all symbols from PACKAGES.
If VISIBILITY is specified, only include symbols with that visibility.
If TYPE is specified, only include symbols of that type.

PACKAGES can be a single package designator or a list of package designators. VISIBILITY can be one of :ANY, :INTERNAL, :EXTERNAL, or :INHERITED.

Package

nsymbols.

Source

nsymbols.lisp.

Function: package-variables (packages &optional visibility)
Package

nsymbols.

Source

nsymbols.lisp.

Function: resolve-symbol (designator type &optional packages error-p)

Find the symbol (of symbol type TYPE) designated by DESIGNATOR in PACKAGES (and subpackages). PACKAGES should be a package designator or a list thereof.
ERROR-P, when present and true, raises a continuable error of type ‘multiple-resolved-symbols-error’ if there is more than one symbol
found matching the DESIGNATOR.

Package

nsymbols.

Source

nsymbols.lisp.

Function: structure-symbol-p (%symbol%)
Package

nsymbols.

Source

nsymbols.lisp.

Function: symbol-visibility (symbol)
Package

nsymbols.

Source

nsymbols.lisp.

Function: variable-symbol-p (%symbol%)
Package

nsymbols.

Source

nsymbols.lisp.


5.1.4 Conditions

Condition: multiple-resolved-symbols-error
Package

nsymbols.

Source

nsymbols.lisp.

Direct superclasses

error.

Direct methods
Direct slots
Slot: designator
Initargs

:designator

Readers

designator.

Writers

(setf designator).

Slot: results
Initargs

:results

Readers

results.

Writers

(setf results).


5.1.5 Types

Type: class-symbol ()
Package

nsymbols.

Source

nsymbols.lisp.

Type: function-symbol ()
Package

nsymbols.

Source

nsymbols.lisp.

Type: generic-function-symbol ()
Package

nsymbols.

Source

nsymbols.lisp.

Type: macro-symbol ()
Package

nsymbols.

Source

nsymbols.lisp.

Type: structure-symbol ()
Package

nsymbols.

Source

nsymbols.lisp.

Type: symbol-visibility ()
Package

nsymbols.

Source

nsymbols.lisp.

Type: variable-symbol ()
Package

nsymbols.

Source

nsymbols.lisp.


5.2 Internals


5.2.1 Special variables

Special Variable: *symbol-types*

The table from the name of the symbol type (as a symbol name string) to the predicate of this type as a function symbol.

Package

nsymbols.

Source

nsymbols.lisp.


5.2.2 Generic functions

Generic Reader: designator (condition)
Generic Writer: (setf designator) (condition)
Package

nsymbols.

Methods
Reader Method: designator ((condition multiple-resolved-symbols-error))
Writer Method: (setf designator) ((condition multiple-resolved-symbols-error))
Source

nsymbols.lisp.

Target Slot

designator.

Generic Reader: results (condition)
Generic Writer: (setf results) (condition)
Package

nsymbols.

Methods
Reader Method: results ((condition multiple-resolved-symbols-error))
Writer Method: (setf results) ((condition multiple-resolved-symbols-error))
Source

nsymbols.lisp.

Target Slot

results.


5.2.3 Types

Type: package-designator ()
Package

nsymbols.

Source

nsymbols.lisp.

Type: string-designator ()
Package

nsymbols.

Source

nsymbols.lisp.

Type: symbol-type (type)
Package

nsymbols.

Source

nsymbols.lisp.


Appendix A Indexes


A.1 Concepts


A.2 Functions

Jump to:   (  
C   D   F   G   M   P   R   S   V  
Index Entry  Section

(
(setf designator): Private generic functions
(setf designator): Private generic functions
(setf results): Private generic functions
(setf results): Private generic functions

C
class-symbol-p: Public ordinary functions

D
define-symbol-type: Public macros
designator: Private generic functions
designator: Private generic functions

F
filter-symbols: Public ordinary functions
Function, class-symbol-p: Public ordinary functions
Function, filter-symbols: Public ordinary functions
Function, function-symbol-p: Public ordinary functions
Function, generic-function-symbol-p: Public ordinary functions
Function, macro-symbol-p: Public ordinary functions
Function, package-classes: Public ordinary functions
Function, package-functions: Public ordinary functions
Function, package-generic-functions: Public ordinary functions
Function, package-macros: Public ordinary functions
Function, package-structures: Public ordinary functions
Function, package-symbols: Public ordinary functions
Function, package-variables: Public ordinary functions
Function, resolve-symbol: Public ordinary functions
Function, structure-symbol-p: Public ordinary functions
Function, symbol-visibility: Public ordinary functions
Function, variable-symbol-p: Public ordinary functions
function-symbol-p: Public ordinary functions

G
Generic Function, (setf designator): Private generic functions
Generic Function, (setf results): Private generic functions
Generic Function, designator: Private generic functions
Generic Function, results: Private generic functions
generic-function-symbol-p: Public ordinary functions

M
Macro, define-symbol-type: Public macros
macro-symbol-p: Public ordinary functions
Method, (setf designator): Private generic functions
Method, (setf results): Private generic functions
Method, designator: Private generic functions
Method, results: Private generic functions

P
package-classes: Public ordinary functions
package-functions: Public ordinary functions
package-generic-functions: Public ordinary functions
package-macros: Public ordinary functions
package-structures: Public ordinary functions
package-symbols: Public ordinary functions
package-variables: Public ordinary functions

R
resolve-symbol: Public ordinary functions
results: Private generic functions
results: Private generic functions

S
structure-symbol-p: Public ordinary functions
symbol-visibility: Public ordinary functions

V
variable-symbol-p: Public ordinary functions