The lense Reference Manual

This is the lense Reference Manual, version 0.0.0, generated automatically by Declt version 4.0 beta 2 "William Riker" on Mon Feb 26 16:53:01 2024 GMT+0.

Table of Contents


1 Introduction


2 Systems

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


2.1 lense

Racket style lenses for the Common Lisp.

Maintainer

Marek Kochanowicz

Author

Marek Kochanowicz

License

BSD-2

Version

0.0.0

Dependencies
  • alexandria (system).
  • documentation-utils-extensions (system).
  • closer-mop (system).
Source

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

Source

lense.asd.

Parent Component

lense (system).

ASDF Systems

lense.


3.1.2 lense/package.lisp

Source

lense.asd.

Parent Component

lense (system).

Packages

lense.


3.1.3 lense/macros.lisp

Dependency

package.lisp (file).

Source

lense.asd.

Parent Component

lense (system).

Public Interface

for (macro).


3.1.4 lense/types.lisp

Dependency

macros.lisp (file).

Source

lense.asd.

Parent Component

lense (system).

Public Interface
Internals

3.1.5 lense/protocol.lisp

Dependency

types.lisp (file).

Source

lense.asd.

Parent Component

lense (system).

Public Interface

3.1.6 lense/implementation.lisp

Dependency

protocol.lisp (file).

Source

lense.asd.

Parent Component

lense (system).

Public Interface

3.1.7 lense/documentation.lisp

Dependency

implementation.lisp (file).

Source

lense.asd.

Parent Component

lense (system).


4 Packages

Packages are listed by definition order.


4.1 lense

Source

package.lisp.

Use List
  • alexandria.
  • 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 Macros

Macro: for ((symbol &rest arguments))

Description:
Macro. Expands to construction of BASIC-LENS for designated SETFable place.

Exceptional situations:
Use of this macro should include one symbol :_ in the arguments designating position in the lambda list where OBJECT should be placed. If there is either more than one such symbol in the ARGUMETS or there is none, the CL:PROGRAM-ERROR will be raised.

Package

lense.

Source

macros.lisp.


5.1.2 Ordinary functions

Function: access (lense object)

Description:
SETFable alternative to the READ function.

See also:
–READ
–WRITE

Package

lense.

Source

protocol.lisp.

Function: (setf access) (lense object)
Package

lense.

Source

protocol.lisp.

Function: compose (lense &rest more-lenses)

Description:
Stacks lenses on each other to build a COMPOSED-LENS.

Returns:
Instance of COMPOSED-LENSE.

Exceptional situations:
Every argument must be a lense supporting GATHER function.

Package

lense.

Source

protocol.lisp.


5.1.3 Generic functions

Generic Function: gather (lense &optional destination-vector)

Description:
This function gathers all elementary lenses from the input lense into the DESTINATION-VECTOR. This is required for the simplicity and efficiency of the COMPOSE function. Constructed COMPOSED-LENSE has flat internal lenses structure which eleminates pointless recursive calls that can potentially occur otherwise.

Returns:
DESTINATION-VECTOR

Exceptional situations:
Will signal CL:TYPE-ERROR (with interactive restart) if DESTINATION-VECTOR is not (AND (VECTOR T) (SATISFIES ADJUSTABLE-ARRAY-P))

Package

lense.

Source

protocol.lisp.

Methods
Method: gather ((lense composed-lense) &optional destination-vector)
Source

implementation.lisp.

Method: gather ((lense fundamental-lense) &optional destination-vector)
Source

implementation.lisp.

Generic Function: read (lense object)

Arguments:
–LENSE, LENS used to read the OBJECT.
–OBJECT, OBJECT that is being read.

Description:
Read trough the lens. Use the LENS to retrieve value from the OBJECT.

Returns:
Value obtained.

See also:
–ACCESS
–WRITE

Notes:
Instead of calling this function, one may funcall LENSE object directly on data.

Package

lense.

Source

protocol.lisp.

Methods
Method: read ((lense composed-lense) object)
Source

implementation.lisp.

Method: read ((lense basic-lense) object)
Source

implementation.lisp.

Generic Function: transform (lense transformation object)

Description:
READ value from the lens. FUNCALL passed transformation on the value. WRITE value back, using the same lense.

Exceptional situations:
–Will signal CL:TYPE-ERROR (with restart) if TRANSFORMATION is not a function.

Notes:
Specialization of this generic function for the COMPOSED-LENSE will not pipe object via the sublenses twice.

Package

lense.

Source

protocol.lisp.

Methods
Method: transform ((lense composed-lense) transformation object)
Source

implementation.lisp.

Method: transform ((lense fundamental-lense) transformation object)
Generic Function: write (lense value object)

Arguments:
–LENSE, LENS used to read the OBJECT.
–VALUE, VALUE deposited into the OBJECT.
–OBJECT, OBJECT that is being read.

Description:
Write trough the lens. Use the LENS to deposit value into the OBJECT.

See also:
–ACCESS
–READ

Package

lense.

Source

protocol.lisp.

Methods
Method: write ((lense composed-lense) value object)
Source

implementation.lisp.

Method: write ((lense basic-lense) value object)
Source

implementation.lisp.


5.1.4 Standalone methods

Method: initialize-instance :after ((lense fundamental-lense) &key &allow-other-keys)
Source

implementation.lisp.


5.1.5 Classes

Class: basic-lense

Description:
Elementary lense, acts as a wrapper around an setfable place. Constructed by expansion of LENS:FOR macro.

Package

lense.

Source

types.lisp.

Direct superclasses

fundamental-lense.

Direct methods
Direct slots
Slot: %read-callback
Initargs

:read-callback

Readers

read-callback.

Writers

This slot is read-only.

Slot: %write-callback
Initargs

:write-callback

Readers

write-callback.

Writers

This slot is read-only.

Class: composed-lense

Description:
COMPOSED-LENSE pipes all READ, WRITE and COMPOSE calls trough the lenses used to construct the result (from left to right, in the opposite order to the ALEXANDRIA:COMPOSE).

Package

lense.

Source

types.lisp.

Direct superclasses

fundamental-lense.

Direct methods
Direct slots
Slot: %internal-lenses
Initargs

:internal-lenses

Readers

internal-lenses.

Writers

This slot is read-only.

Class: fundamental-lense

Description:
Fundamental class of all lenses. All subclasses of this class should support following generic functions: READ, WRITE. TRANSFORM and GATHER have potentially usefull default methods (TRANSFORM simply calls READ and WRITE in a succession which may or may not be efficient, GATHER simply puts the lense into the result vector).

Package

lense.

Source

types.lisp.

Direct superclasses

funcallable-standard-object.

Direct subclasses
Direct methods

5.2 Internals


5.2.1 Generic functions

Generic Reader: internal-lenses (object)
Package

lense.

Methods
Reader Method: internal-lenses ((composed-lense composed-lense))

automatically generated reader method

Source

types.lisp.

Target Slot

%internal-lenses.

Generic Reader: read-callback (object)
Package

lense.

Methods
Reader Method: read-callback ((basic-lense basic-lense))

automatically generated reader method

Source

types.lisp.

Target Slot

%read-callback.

Generic Reader: write-callback (object)
Package

lense.

Methods
Reader Method: write-callback ((basic-lense basic-lense))

automatically generated reader method

Source

types.lisp.

Target Slot

%write-callback.


Appendix A Indexes


A.1 Concepts


A.2 Functions

Jump to:   (  
A   C   F   G   I   M   R   T   W  
Index Entry  Section

(
(setf access): Public ordinary functions

A
access: Public ordinary functions

C
compose: Public ordinary functions

F
for: Public macros
Function, (setf access): Public ordinary functions
Function, access: Public ordinary functions
Function, compose: Public ordinary functions

G
gather: Public generic functions
gather: Public generic functions
gather: Public generic functions
Generic Function, gather: Public generic functions
Generic Function, internal-lenses: Private generic functions
Generic Function, read: Public generic functions
Generic Function, read-callback: Private generic functions
Generic Function, transform: Public generic functions
Generic Function, write: Public generic functions
Generic Function, write-callback: Private generic functions

I
initialize-instance: Public standalone methods
internal-lenses: Private generic functions
internal-lenses: Private generic functions

M
Macro, for: Public macros
Method, gather: Public generic functions
Method, gather: Public generic functions
Method, initialize-instance: Public standalone methods
Method, internal-lenses: Private generic functions
Method, read: Public generic functions
Method, read: Public generic functions
Method, read-callback: Private generic functions
Method, transform: Public generic functions
Method, transform: Public generic functions
Method, write: Public generic functions
Method, write: Public generic functions
Method, write-callback: Private generic functions

R
read: Public generic functions
read: Public generic functions
read: Public generic functions
read-callback: Private generic functions
read-callback: Private generic functions

T
transform: Public generic functions
transform: Public generic functions
transform: Public generic functions

W
write: Public generic functions
write: Public generic functions
write: Public generic functions
write-callback: Private generic functions
write-callback: Private generic functions