The data-lens Reference Manual

This is the data-lens Reference Manual, generated automatically by Declt version 4.0 beta 2 "William Riker" on Sun Sep 15 04:57:28 2024 GMT+0.

Table of Contents


1 Introduction


2 Systems

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


2.1 data-lens

Utilities for building data transformations from composable functions, modeled on lenses and transducers

Author

Edward Langley <>

License

Apache v2

Dependencies
  • cl-ppcre (system).
  • alexandria (system).
Source

data-lens.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 data-lens/data-lens.asd

Source

data-lens.asd.

Parent Component

data-lens (system).

ASDF Systems

data-lens.


3.1.2 data-lens/package.lisp

Source

data-lens.asd.

Parent Component

data-lens (system).

Packages

3.1.3 data-lens/optics.lisp

Dependency

package.lisp (file).

Source

data-lens.asd.

Parent Component

data-lens (system).

Public Interface
Internals

3.1.4 data-lens/lens.lisp

Dependency

optics.lisp (file).

Source

data-lens.asd.

Parent Component

data-lens (system).

Public Interface
Internals

4 Packages

Packages are listed by definition order.


4.1 data-lens.package

Source

package.lisp.

Use List

common-lisp.


4.2 data-lens

Source

package.lisp.

Use List

common-lisp.

Public Interface
Internals

4.3 data-lens.lenses

Source

package.lisp.

Use List

common-lisp.

Public Interface
Internals

4.4 data-lens.transducers

Source

package.lisp.

Use List

common-lisp.


4.5 data-lens.transducers.internals

Source

package.lisp.

Use List

common-lisp.


5 Definitions

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


5.1 Public Interface


5.1.1 Macros

Macro: <>1 (&rest funs)
Package

data-lens.

Source

lens.lisp.

Macro: applying (fun &rest args)
Package

data-lens.

Source

lens.lisp.

Macro: calling (fun &rest args)
Package

data-lens.

Source

lens.lisp.

Macro: calling* (fun &rest args)
Package

data-lens.

Source

lens.lisp.

Macro: conj (&rest fns)
Package

data-lens.

Source

lens.lisp.

Macro: defun-ct (name (&rest args) &body body)
Package

data-lens.

Source

lens.lisp.

Macro: disj (&rest fns)
Package

data-lens.

Source

lens.lisp.

Macro: let-fn ((&rest bindings) &body body)
Package

data-lens.

Source

lens.lisp.

Macro: shortcut (name function &body bound-args)
Package

data-lens.

Source

lens.lisp.

Macro: (&rest funs)
Package

data-lens.

Source

lens.lisp.

Macro: (&rest funs)
Package

data-lens.

Source

lens.lisp.


5.1.2 Compiler macros

Compiler Macro: functionalize (it)
Package

data-lens.

Source

lens.lisp.


5.1.3 Ordinary functions

Function: == (target &key test)
Package

data-lens.

Source

lens.lisp.

Function: applicable-when (fun test &optional default)
Package

data-lens.

Source

lens.lisp.

Function: combine-matching-lists (&key test &allow-other-keys)
Package

data-lens.

Source

lens.lisp.

Function: compress-runs (&key collector test key)
Package

data-lens.

Source

lens.lisp.

Function: cumsum (&key add-fun key combine zero)
Package

data-lens.

Source

lens.lisp.

Function: delay ()

Return a function that always returns the last thing it was called with

Package

data-lens.

Source

lens.lisp.

Function: denest (&key result-type)
Package

data-lens.

Source

lens.lisp.

Function: derive (diff-fun &key key)
Package

data-lens.

Source

lens.lisp.

Function: element (num)
Package

data-lens.

Source

lens.lisp.

Function: exclude (pred)
Package

data-lens.

Source

lens.lisp.

Function: group-by (fn &key test)
Package

data-lens.

Source

lens.lisp.

Function: inc (inc)
Package

data-lens.

Source

lens.lisp.

Function: include (pred)
Package

data-lens.

Source

lens.lisp.

Function: juxt (fun1 &rest r)
Package

data-lens.

Source

lens.lisp.

Function: key (key)
Package

data-lens.

Source

lens.lisp.

Function: key-transform (fun key-get key-set)
Package

data-lens.

Source

lens.lisp.

Function: keys (key &rest keys)
Package

data-lens.

Source

lens.lisp.

Function: make-alist-lens (key)

A lens for updating a alist, discarding previous values

Package

data-lens.lenses.

Source

optics.lisp.

Function: make-hash-table-lens (key)

A lens for updating a hash-table, discarding previous values

Package

data-lens.lenses.

Source

optics.lisp.

Function: make-list-lens (index)

A lens for updating a sequence

Package

data-lens.lenses.

Source

optics.lisp.

Function: make-plist-lens (key)

A lens for updating a plist, preserving previous values

Package

data-lens.lenses.

Source

optics.lisp.

Function: maximizing (relation measure)
Package

data-lens.

Source

lens.lisp.

Function: of-length (len)
Package

data-lens.

Source

lens.lisp.

Function: of-max-length (len)
Package

data-lens.

Source

lens.lisp.

Function: of-min-length (len)
Package

data-lens.

Source

lens.lisp.

Function: of-type (type)
Package

data-lens.

Source

lens.lisp.

Function: on (fun key)

Transform arguments with KEY and then apply FUN

> (eql (funcall (on ’equal ’car)
> ’("a" 1 2)
> ’("a" 2 e))
> t)

Package

data-lens.

Source

lens.lisp.

Function: over (fun &rest funs)
Package

data-lens.

Source

lens.lisp.

Function: over (lens cb rec)

Given a lens, a callback and a record, apply the lens to the record, transform it by the callback and return copy of the record, updated to contain the result of the callback. This is the fundamental operation on a lens and SET and VIEW are implemented in terms of it.

A lens is any function of the form (lambda (fun) (lambda (rec) ...)) that obeys the lens laws (where == is some reasonable equality operator):

(== (view lens (set lens value rec))
value)

(== (set lens (view lens rec) rec)
rec)

(== (set lens value2 (set lens value1 rec))
(set lens value2 rec))

The inner lambda returns a functor that determines the policy to be applied to the focused part. By default, this only uses IDENTITY- and CONSTANT- in order to implement the lens operations over, set and view.

If these conditions are met, (over (data-lens:<>1 lens1 lens2) ...) is equivalent to using lens2 to focus the part lens1 focuses: note that composition is "backwards" from what one might expect: this is because composition composes the wrapper lambdas and applies the lambda that actually pulls a value out of a record later.

Package

data-lens.lenses.

Source

optics.lisp.

Function: pick (selector)
Package

data-lens.

Source

lens.lisp.

Function: regex-match (regex)
Package

data-lens.

Source

lens.lisp.

Function: set (lens v rec)

Given a lens, a value and a rec, immutably update the rec to contain the new value at the location focused by the lens.

Package

data-lens.lenses.

Source

optics.lisp.

Function: slice (start &optional end)
Package

data-lens.

Source

lens.lisp.

Function: sorted (comparator &rest r &key key)
Package

data-lens.

Source

lens.lisp.

Function: splice-elt (elt fun)
Package

data-lens.

Source

lens.lisp.

Function: suffixp (suffix &key test)
Package

data-lens.

Source

lens.lisp.

Function: transform (arg &rest args)
Package

data-lens.

Source

lens.lisp.

Function: transform-elt (elt fun)
Package

data-lens.

Source

lens.lisp.

Function: transform-head (fun)
Package

data-lens.

Source

lens.lisp.

Function: transform-tail (fun)
Package

data-lens.

Source

lens.lisp.

Function: view (lens rec)

Given a lens and a rec, return the focused value

Package

data-lens.lenses.

Source

optics.lisp.

Function: zipping (result-type &key fill-value)
Package

data-lens.

Source

lens.lisp.


5.1.4 Generic functions

Generic Function: extract-key (map key)
Package

data-lens.

Source

lens.lisp.

Methods
Method: extract-key ((map hash-table) key)
Method: extract-key ((map list) key)
Generic Function: functionalize (it)
Package

data-lens.

Source

lens.lisp.

Methods
Method: functionalize ((it hash-table))
Method: functionalize ((it vector))
Method: functionalize ((it symbol))
Method: functionalize ((it function))

5.1.5 Standalone methods

Method: print-object ((o constant-) s)
Source

optics.lisp.

Method: print-object ((o identity-) s)
Source

optics.lisp.


5.2 Internals


5.2.1 Macros

Macro: updatef (place fun &rest args)
Package

data-lens.

Source

lens.lisp.


5.2.2 Ordinary functions

Function: =>> (fun1 fun2)
Package

data-lens.

Source

lens.lisp.

Function: cons-new (&key test key)
Package

data-lens.

Source

lens.lisp.

Function: deduplicate (&optional test)
Package

data-lens.

Source

lens.lisp.

Function: filler (length1 length2 fill-value)
Package

data-lens.

Source

lens.lisp.

Function: make-alist-history-lens (key)

A lens for updating a alist, preserving previous values

Package

data-lens.lenses.

Source

optics.lisp.

Function: matching-list-reducer (test acc next)
Package

data-lens.

Source

lens.lisp.

Function: update (thing fun &rest args)
Package

data-lens.

Source

lens.lisp.

Function: wrap-constant (v)
Package

data-lens.lenses.

Source

optics.lisp.

Function: wrap-identity (v)
Package

data-lens.lenses.

Source

optics.lisp.


5.2.3 Generic functions

Generic Function: clone (obj &rest new-initargs &key)
Package

data-lens.lenses.

Source

optics.lisp.

Methods
Method: clone :around (obj &rest new-initargs &key)
Generic Function: fmap (function data)
Package

data-lens.lenses.

Source

optics.lisp.

Methods
Method: fmap (function (data identity-))
Method: fmap (function (data constant-))
Method: fmap (function (data list))
Method: fmap (function (data vector))
Generic Reader: unconstant (object)
Package

data-lens.lenses.

Methods
Reader Method: unconstant ((constant- constant-))

automatically generated reader method

Source

optics.lisp.

Target Slot

%v.

Generic Reader: unidentity (object)
Package

data-lens.lenses.

Methods
Reader Method: unidentity ((identity- identity-))

automatically generated reader method

Source

optics.lisp.

Target Slot

%v.


5.2.4 Classes

Class: constant-
Package

data-lens.lenses.

Source

optics.lisp.

Direct methods
Direct slots
Slot: %v
Initargs

:value

Readers

unconstant.

Writers

This slot is read-only.

Class: identity-
Package

data-lens.lenses.

Source

optics.lisp.

Direct methods
Direct slots
Slot: %v
Initargs

:value

Readers

unidentity.

Writers

This slot is read-only.


Appendix A Indexes


A.1 Concepts


A.2 Functions

Jump to:   <   =      
A   C   D   E   F   G   I   J   K   L   M   O   P   R   S   T   U   V   W   Z  
Index Entry  Section

<
<>1: Public macros

=
==: Public ordinary functions
=>>: Private ordinary functions

: Public macros

: Public macros

A
applicable-when: Public ordinary functions
applying: Public macros

C
calling: Public macros
calling*: Public macros
clone: Private generic functions
clone: Private generic functions
combine-matching-lists: Public ordinary functions
Compiler Macro, functionalize: Public compiler macros
compress-runs: Public ordinary functions
conj: Public macros
cons-new: Private ordinary functions
cumsum: Public ordinary functions

D
deduplicate: Private ordinary functions
defun-ct: Public macros
delay: Public ordinary functions
denest: Public ordinary functions
derive: Public ordinary functions
disj: Public macros

E
element: Public ordinary functions
exclude: Public ordinary functions
extract-key: Public generic functions
extract-key: Public generic functions
extract-key: Public generic functions

F
filler: Private ordinary functions
fmap: Private generic functions
fmap: Private generic functions
fmap: Private generic functions
fmap: Private generic functions
fmap: Private generic functions
Function, ==: Public ordinary functions
Function, =>>: Private ordinary functions
Function, applicable-when: Public ordinary functions
Function, combine-matching-lists: Public ordinary functions
Function, compress-runs: Public ordinary functions
Function, cons-new: Private ordinary functions
Function, cumsum: Public ordinary functions
Function, deduplicate: Private ordinary functions
Function, delay: Public ordinary functions
Function, denest: Public ordinary functions
Function, derive: Public ordinary functions
Function, element: Public ordinary functions
Function, exclude: Public ordinary functions
Function, filler: Private ordinary functions
Function, group-by: Public ordinary functions
Function, inc: Public ordinary functions
Function, include: Public ordinary functions
Function, juxt: Public ordinary functions
Function, key: Public ordinary functions
Function, key-transform: Public ordinary functions
Function, keys: Public ordinary functions
Function, make-alist-history-lens: Private ordinary functions
Function, make-alist-lens: Public ordinary functions
Function, make-hash-table-lens: Public ordinary functions
Function, make-list-lens: Public ordinary functions
Function, make-plist-lens: Public ordinary functions
Function, matching-list-reducer: Private ordinary functions
Function, maximizing: Public ordinary functions
Function, of-length: Public ordinary functions
Function, of-max-length: Public ordinary functions
Function, of-min-length: Public ordinary functions
Function, of-type: Public ordinary functions
Function, on: Public ordinary functions
Function, over: Public ordinary functions
Function, over: Public ordinary functions
Function, pick: Public ordinary functions
Function, regex-match: Public ordinary functions
Function, set: Public ordinary functions
Function, slice: Public ordinary functions
Function, sorted: Public ordinary functions
Function, splice-elt: Public ordinary functions
Function, suffixp: Public ordinary functions
Function, transform: Public ordinary functions
Function, transform-elt: Public ordinary functions
Function, transform-head: Public ordinary functions
Function, transform-tail: Public ordinary functions
Function, update: Private ordinary functions
Function, view: Public ordinary functions
Function, wrap-constant: Private ordinary functions
Function, wrap-identity: Private ordinary functions
Function, zipping: Public ordinary functions
functionalize: Public compiler macros
functionalize: Public generic functions
functionalize: Public generic functions
functionalize: Public generic functions
functionalize: Public generic functions
functionalize: Public generic functions

G
Generic Function, clone: Private generic functions
Generic Function, extract-key: Public generic functions
Generic Function, fmap: Private generic functions
Generic Function, functionalize: Public generic functions
Generic Function, unconstant: Private generic functions
Generic Function, unidentity: Private generic functions
group-by: Public ordinary functions

I
inc: Public ordinary functions
include: Public ordinary functions

J
juxt: Public ordinary functions

K
key: Public ordinary functions
key-transform: Public ordinary functions
keys: Public ordinary functions

L
let-fn: Public macros

M
Macro, <>1: Public macros
Macro, applying: Public macros
Macro, calling: Public macros
Macro, calling*: Public macros
Macro, conj: Public macros
Macro, defun-ct: Public macros
Macro, disj: Public macros
Macro, let-fn: Public macros
Macro, shortcut: Public macros
Macro, updatef: Private macros
Macro, : Public macros
Macro, : Public macros
make-alist-history-lens: Private ordinary functions
make-alist-lens: Public ordinary functions
make-hash-table-lens: Public ordinary functions
make-list-lens: Public ordinary functions
make-plist-lens: Public ordinary functions
matching-list-reducer: Private ordinary functions
maximizing: Public ordinary functions
Method, clone: Private generic functions
Method, extract-key: Public generic functions
Method, extract-key: Public generic functions
Method, fmap: Private generic functions
Method, fmap: Private generic functions
Method, fmap: Private generic functions
Method, fmap: Private generic functions
Method, functionalize: Public generic functions
Method, functionalize: Public generic functions
Method, functionalize: Public generic functions
Method, functionalize: Public generic functions
Method, print-object: Public standalone methods
Method, print-object: Public standalone methods
Method, unconstant: Private generic functions
Method, unidentity: Private generic functions

O
of-length: Public ordinary functions
of-max-length: Public ordinary functions
of-min-length: Public ordinary functions
of-type: Public ordinary functions
on: Public ordinary functions
over: Public ordinary functions
over: Public ordinary functions

P
pick: Public ordinary functions
print-object: Public standalone methods
print-object: Public standalone methods

R
regex-match: Public ordinary functions

S
set: Public ordinary functions
shortcut: Public macros
slice: Public ordinary functions
sorted: Public ordinary functions
splice-elt: Public ordinary functions
suffixp: Public ordinary functions

T
transform: Public ordinary functions
transform-elt: Public ordinary functions
transform-head: Public ordinary functions
transform-tail: Public ordinary functions

U
unconstant: Private generic functions
unconstant: Private generic functions
unidentity: Private generic functions
unidentity: Private generic functions
update: Private ordinary functions
updatef: Private macros

V
view: Public ordinary functions

W
wrap-constant: Private ordinary functions
wrap-identity: Private ordinary functions

Z
zipping: Public ordinary functions


A.3 Variables

Jump to:   %  
S  
Index Entry  Section

%
%v: Private classes
%v: Private classes

S
Slot, %v: Private classes
Slot, %v: Private classes