The modf Reference Manual

This is the modf Reference Manual, generated automatically by Declt version 4.0 beta 2 "William Riker" on Mon Feb 26 17:22:13 2024 GMT+0.

Table of Contents


1 Introduction


2 Systems

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


2.1 modf

A SETF like macro for functional programming

Author

Zach Kost-Smith <>

License

3 Clause BSD (http://opensource.org/licenses/BSD-3-Clause)

Long Description

This library simplifies functional programming by making it easier to make new data structures with specified changes in place.

Dependencies
  • alexandria (system).
  • closer-mop (system).
  • iterate (system).
Source

modf.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 modf/modf.asd

Source

modf.asd.

Parent Component

modf (system).

ASDF Systems

modf.


3.1.2 modf/package.lisp

Source

modf.asd.

Parent Component

modf (system).

Packages

modf.


3.1.3 modf/utils.lisp

Dependency

package.lisp (file).

Source

modf.asd.

Parent Component

modf (system).

Internals

mkstr (function).


3.1.4 modf/modf.lisp

Dependency

utils.lisp (file).

Source

modf.asd.

Parent Component

modf (system).

Public Interface
Internals

3.1.5 modf/rewrite-rules.lisp

Dependency

modf.lisp (file).

Source

modf.asd.

Parent Component

modf (system).


3.1.7 modf/modf-def.lisp

Dependency

basic.lisp (file).

Source

modf.asd.

Parent Component

modf (system).

Packages

modf-def.

Public Interface
Internals

4 Packages

Packages are listed by definition order.


4.1 modf-def

Source

modf-def.lisp.

Use List
  • common-lisp.
  • iterate.
  • modf.
Public Interface
Internals

4.2 modf

Source

package.lisp.

Use List
  • common-lisp.
  • iterate.
Used By List

modf-def.

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 Macros

Macro: defclass (name direct-superclasses direct-slots &rest options)

Define Modf expansions for class slot accessor and reader methods.

Package

modf-def.

Source

modf-def.lisp.

Macro: define-modf-expander (name nth-arg (expr val new-val) &body body)

Define a new expander which inverts forms starting with NAME. Your function should return an expansion from EXPR to a form that will build a new object that has NEW-VAL in the place specified by expr. NTH-ARG marks which argument is considered the actual data which will be inverted next.

Package

modf.

Source

modf.lisp.

Macro: define-modf-for-class-slots (class-name-or-definition)

This macro defines Modf expanders for a class. We can do this given the definition form for the class (much like with DEFINE-MODF-FOR-STRUCT-SLOTS) or the a name of a finalized class.

Package

modf-def.

Source

modf-def.lisp.

Macro: define-modf-for-struct-slots (structure-definition-form)

This macro defines Modf expanders for structure slots when given a structure definition form.

Package

modf-def.

Source

modf-def.lisp.

Macro: define-modf-function (name nth-arg (new-val &rest args) &body body)

Define a new modf function. It inverts NAME forms by modifying the NTH-ARG term of the arguments of the place form in the MODF macro.

Package

modf.

Source

modf.lisp.

Macro: define-modf-method (name nth-arg (new-val &rest args) &body body)

Define a new modf method. It inverts NAME forms by modifying the NTH-ARG term of the arguments of the place form in the MODF macro. This method can specialize on any of ARGS.

Package

modf.

Source

modf.lisp.

Macro: define-modf-rewrite (name (expr) &body body)

Define a new rewrite rule. If a form starting with NAME is encountered, call the defined function to return a form that we can deal with (i.e. one defined via DEFINE-MODF-EXPANDER, DEFINE-MODF-FUNCTION, and DEFINE-MODF-METHOD).

Package

modf.

Source

modf.lisp.

Macro: defstruct (name-and-options &rest slot-descriptions)

Define a new structure with Modf expansions for slots.

Package

modf-def.

Source

modf-def.lisp.

Macro: fsetf (place value &rest more)
Package

modf.

Source

modf.lisp.

Macro: modf (place value &rest more)

Make a new object (which may use some of the old object) such that PLACE evaluates to VALUE.

MORE should have the form...

MORE : NIL
| (TEMPORARY-BINDING ANOTHER-MODF-PLACE ANOTHER-VALUE . MORE)

Use it to specify a temporary binding for the new object created which will be used in the subsequence MODF-PLACE NEW-VALUE pairs until the end of the MODF form.

Package

modf.

Source

modf.lisp.

Macro: modf-eval (&rest args)
Package

modf.

Source

modf.lisp.

Macro: modf-fn (symbol)

Expand to the defined Modf function. Basically, (MODF-FN SYM) is the functional analog of #’(SETF SYM).

Package

modf.

Source

modf.lisp.


5.2 Internals


5.2.1 Special variables

Special Variable: *accessor-heuristics*

This controls whether we should make educated guesses regarding inverting structure slot readers. For strictly correct behavior, set this to nil.

Package

modf.

Source

modf.lisp.

Special Variable: *modf-expansions*

Holds expansion functions

Package

modf.

Source

modf.lisp.

Special Variable: *modf-nth-arg*

Holds what argument to try to invert next.

Package

modf.

Source

modf.lisp.

Special Variable: *modf-rewrites*
Package

modf.

Source

modf.lisp.

Special Variable: *special-modf-forms*
Package

modf.

Source

modf.lisp.


5.2.2 Ordinary functions

Function: accessor-in (expr)
Package

modf.

Source

modf.lisp.

Function: apply-expression? (expr)
Package

modf.

Source

modf.lisp.

Function: builder:common-lisp:aref (new-val array &rest idx)
Package

modf.

Source

basic.lisp.

Function: builder:common-lisp:getf (new-val plist key)
Package

modf.

Source

basic.lisp.

Function: builder:common-lisp:gethash (new-val key hash-table)
Package

modf.

Source

basic.lisp.

Function: builder:common-lisp:last (new-val obj)
Package

modf.

Source

basic.lisp.

Function: builder:common-lisp:nth (new-val nth obj)
Package

modf.

Source

basic.lisp.

Function: builder:common-lisp:nthcdr (new-val nth obj)
Package

modf.

Source

basic.lisp.

Function: builder:common-lisp:subseq (new-val seq start &optional end)
Package

modf.

Source

basic.lisp.

Function: container-arg-n (expr)
Package

modf.

Source

modf.lisp.

Function: copy-instance (obj)
Package

modf.

Source

basic.lisp.

Function: expandable? (expr)
Package

modf.

Source

modf.lisp.

Function: expansions-defined? (expr)
Package

modf.

Source

modf.lisp.

Function: find-container (place)
Package

modf.

Source

modf.lisp.

Function: funcall-expression? (expr)
Package

modf.

Source

modf.lisp.

Function: get-modf-reader-definitions (class &optional defined-readers)
Package

modf-def.

Source

modf-def.lisp.

Function: group (source n)
Package

modf-def.

Source

modf-def.lisp.

Function: group-by (list &rest counts)
Package

modf-def.

Source

modf-def.lisp.

Function: late-class-reader-inverter (func new-val obj)
Package

modf.

Source

modf.lisp.

Function: late-invert (func new-val obj &rest args)

This is a generic catch as much as you can function. It attempts to identify class accessor functions, structure accessor functions, and provides late MODF defined functions (i.e. you used MODF before using DEFINE-MODF-FUNCTION).

All of this functionality is less than ideal efficiency wise, but working over efficiency any day, right? If you want better performance, define all of you functions ahead of time.

Package

modf.

Source

modf.lisp.

Function: mkstr (&rest args)

MaKe STRing

Package

modf.

Source

utils.lisp.

Function: modf-expand (new-val expr enclosed-obj-sym env)
Package

modf.

Source

modf.lisp.

Function: modf-fn-defined? (expr)
Package

modf.

Source

modf.lisp.

Function: modf-for-class-slots-expander (class)
Package

modf-def.

Source

modf-def.lisp.

Function: modf-for-struct-slots-expander (defstruct name-and-options &rest slot-descriptions)
Package

modf-def.

Source

modf-def.lisp.

Function: modf-name (symbol)

Make a symbol name that depends on symbol name and package, but is very unlikely to be chosen by anyone. This is for avoiding collisions for my benefit, not the users, as these symbols belong to the MODF package.

Package

modf.

Source

modf.lisp.

Function: replace-nth (nth list new-val)
Package

modf.

Source

basic.lisp.

Function: replace-nthcdr (nth list new-val)
Package

modf.

Source

basic.lisp.


5.2.3 Generic functions

Generic Function: builder:common-lisp:pathname-directory (new-val path)
Package

modf.

Methods
Method: builder:common-lisp:pathname-directory (new-val path)
Source

basic.lisp.

Generic Function: builder:common-lisp:pathname-name (new-val path)
Package

modf.

Methods
Method: builder:common-lisp:pathname-name (new-val path)
Source

basic.lisp.

Generic Function: builder:common-lisp:pathname-type (new-val path)
Package

modf.

Methods
Method: builder:common-lisp:pathname-type (new-val path)
Source

basic.lisp.


Appendix A Indexes


A.1 Concepts


A.2 Functions

Jump to:   A   B   C   D   E   F   G   L   M   R  
Index Entry  Section

A
accessor-in: Private ordinary functions
apply-expression?: Private ordinary functions

B
builder:common-lisp:aref: Private ordinary functions
builder:common-lisp:getf: Private ordinary functions
builder:common-lisp:gethash: Private ordinary functions
builder:common-lisp:last: Private ordinary functions
builder:common-lisp:nth: Private ordinary functions
builder:common-lisp:nthcdr: Private ordinary functions
builder:common-lisp:pathname-directory: Private generic functions
builder:common-lisp:pathname-directory: Private generic functions
builder:common-lisp:pathname-name: Private generic functions
builder:common-lisp:pathname-name: Private generic functions
builder:common-lisp:pathname-type: Private generic functions
builder:common-lisp:pathname-type: Private generic functions
builder:common-lisp:subseq: Private ordinary functions

C
container-arg-n: Private ordinary functions
copy-instance: Private ordinary functions

D
defclass: Public macros
define-modf-expander: Public macros
define-modf-for-class-slots: Public macros
define-modf-for-struct-slots: Public macros
define-modf-function: Public macros
define-modf-method: Public macros
define-modf-rewrite: Public macros
defstruct: Public macros

E
expandable?: Private ordinary functions
expansions-defined?: Private ordinary functions

F
find-container: Private ordinary functions
fsetf: Public macros
funcall-expression?: Private ordinary functions
Function, accessor-in: Private ordinary functions
Function, apply-expression?: Private ordinary functions
Function, builder:common-lisp:aref: Private ordinary functions
Function, builder:common-lisp:getf: Private ordinary functions
Function, builder:common-lisp:gethash: Private ordinary functions
Function, builder:common-lisp:last: Private ordinary functions
Function, builder:common-lisp:nth: Private ordinary functions
Function, builder:common-lisp:nthcdr: Private ordinary functions
Function, builder:common-lisp:subseq: Private ordinary functions
Function, container-arg-n: Private ordinary functions
Function, copy-instance: Private ordinary functions
Function, expandable?: Private ordinary functions
Function, expansions-defined?: Private ordinary functions
Function, find-container: Private ordinary functions
Function, funcall-expression?: Private ordinary functions
Function, get-modf-reader-definitions: Private ordinary functions
Function, group: Private ordinary functions
Function, group-by: Private ordinary functions
Function, late-class-reader-inverter: Private ordinary functions
Function, late-invert: Private ordinary functions
Function, mkstr: Private ordinary functions
Function, modf-expand: Private ordinary functions
Function, modf-fn-defined?: Private ordinary functions
Function, modf-for-class-slots-expander: Private ordinary functions
Function, modf-for-struct-slots-expander: Private ordinary functions
Function, modf-name: Private ordinary functions
Function, replace-nth: Private ordinary functions
Function, replace-nthcdr: Private ordinary functions

G
Generic Function, builder:common-lisp:pathname-directory: Private generic functions
Generic Function, builder:common-lisp:pathname-name: Private generic functions
Generic Function, builder:common-lisp:pathname-type: Private generic functions
get-modf-reader-definitions: Private ordinary functions
group: Private ordinary functions
group-by: Private ordinary functions

L
late-class-reader-inverter: Private ordinary functions
late-invert: Private ordinary functions

M
Macro, defclass: Public macros
Macro, define-modf-expander: Public macros
Macro, define-modf-for-class-slots: Public macros
Macro, define-modf-for-struct-slots: Public macros
Macro, define-modf-function: Public macros
Macro, define-modf-method: Public macros
Macro, define-modf-rewrite: Public macros
Macro, defstruct: Public macros
Macro, fsetf: Public macros
Macro, modf: Public macros
Macro, modf-eval: Public macros
Macro, modf-fn: Public macros
Method, builder:common-lisp:pathname-directory: Private generic functions
Method, builder:common-lisp:pathname-name: Private generic functions
Method, builder:common-lisp:pathname-type: Private generic functions
mkstr: Private ordinary functions
modf: Public macros
modf-eval: Public macros
modf-expand: Private ordinary functions
modf-fn: Public macros
modf-fn-defined?: Private ordinary functions
modf-for-class-slots-expander: Private ordinary functions
modf-for-struct-slots-expander: Private ordinary functions
modf-name: Private ordinary functions

R
replace-nth: Private ordinary functions
replace-nthcdr: Private ordinary functions