The data-lens Reference Manual

Table of Contents

Next: , Previous: , Up: (dir)   [Contents][Index]

The data-lens Reference Manual

This is the data-lens Reference Manual, generated automatically by Declt version 2.4 patchlevel 1 "Will Decker" on Mon Jul 29 15:30:29 2019 GMT+0.


Next: , Previous: , Up: Top   [Contents][Index]

1 Introduction

* Intro

This library provides a language for expressing data manipulations as
the composition of more primitive operations.

#+BEGIN_SRC lisp
  DATA-LENS> (funcall (on (alexandria:compose
                           (over (transform-tail (over (slice 1))))
                           (compress-runs :collector 'combine-matching-lists))
                          (alexandria:compose 
                           (over (juxt (element 0)
                                       'identity))
                           (sorted 'char<
                                   :key (element 0))))
                      '("January" "February" "March" "April"
                        "May" "June" "July" "August"
                        "September" "October" "November" "December"))
  #| ==> ((#\A "pril" "ugust")
          (#\D "ecember")
          (#\F "ebruary")
          (#\J "anuary" "une" "uly")
          (#\M "arch" "ay")
          (#\N "ovember")
          (#\O "ctober")
          (#\S "eptember")) |#
#+END_SRC


Next: , Previous: , Up: Top   [Contents][Index]

2 Systems

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


Previous: , Up: Systems   [Contents][Index]

2.1 data-lens

Author

Edward Langley <el-cl@elangley.org>

License

MIT

Description

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

Dependencies
Source

data-lens.asd (file)

Component

lens.lisp (file)


Next: , Previous: , Up: Top   [Contents][Index]

3 Files

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


Previous: , Up: Files   [Contents][Index]

3.1 Lisp


Next: , Previous: , Up: Lisp files   [Contents][Index]

3.1.1 data-lens.asd

Location

data-lens.asd

Systems

data-lens (system)


Previous: , Up: Lisp files   [Contents][Index]

3.1.2 data-lens/lens.lisp

Parent

data-lens (system)

Location

lens.lisp

Packages
Exported Definitions
Internal Definitions

Next: , Previous: , Up: Top   [Contents][Index]

4 Packages

Packages are listed by definition order.


Next: , Previous: , Up: Packages   [Contents][Index]

4.1 data-lens

Source

lens.lisp (file)

Use List

common-lisp

Exported Definitions
Internal Definitions

Previous: , Up: Packages   [Contents][Index]

4.2 data-lens.lenses

Source

lens.lisp (file)

Use List

common-lisp

Exported Definitions
Internal Definitions

Next: , Previous: , Up: Top   [Contents][Index]

5 Definitions

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


Next: , Previous: , Up: Definitions   [Contents][Index]

5.1 Exported definitions


Next: , Previous: , Up: Exported definitions   [Contents][Index]

5.1.1 Macros

Macro: <>1 &rest FUNS
Package

data-lens

Source

lens.lisp (file)

Macro: applying FUN &rest ARGS
Package

data-lens

Source

lens.lisp (file)

Macro: defun-ct NAME (&rest ARGS) &body BODY
Package

data-lens

Source

lens.lisp (file)

Macro: let-fn (&rest BINDINGS) &body BODY
Package

data-lens

Source

lens.lisp (file)

Macro: shortcut NAME FUNCTION &body BOUND-ARGS
Package

data-lens

Source

lens.lisp (file)


Next: , Previous: , Up: Exported definitions   [Contents][Index]

5.1.2 Functions

Function: applicable-when FUN TEST
Package

data-lens

Source

lens.lisp (file)

Function: combine-matching-lists &key TEST &allow-other-keys
Package

data-lens

Source

lens.lisp (file)

Function: compress-runs &key COLLECTOR TEST KEY
Package

data-lens

Source

lens.lisp (file)

Function: cumsum &key ADD-FUN KEY COMBINE ZERO
Package

data-lens

Source

lens.lisp (file)

Function: denest &key RESULT-TYPE
Package

data-lens

Source

lens.lisp (file)

Function: derive DIFF-FUN &key KEY
Package

data-lens

Source

lens.lisp (file)

Function: element NUM
Package

data-lens

Source

lens.lisp (file)

Function: exclude PRED
Package

data-lens

Source

lens.lisp (file)

Function: include PRED
Package

data-lens

Source

lens.lisp (file)

Function: juxt FUN1 &rest R
Package

data-lens

Source

lens.lisp (file)

Function: key KEY
Package

data-lens

Source

lens.lisp (file)

Function: key-transform FUN KEY-GET KEY-SET
Package

data-lens

Source

lens.lisp (file)

Function: make-alist-lens KEY

A lens for updating a alist, discarding previous values

Package

data-lens.lenses

Source

lens.lisp (file)

Function: make-hash-table-lens KEY

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

Package

data-lens.lenses

Source

lens.lisp (file)

Function: make-plist-lens KEY

A lens for updating a plist, preserving previous values

Package

data-lens.lenses

Source

lens.lisp (file)

Function: maximizing RELATION MEASURE
Package

data-lens

Source

lens.lisp (file)

Function: of-length LEN
Package

data-lens

Source

lens.lisp (file)

Function: of-max-length LEN
Package

data-lens

Source

lens.lisp (file)

Function: of-min-length LEN
Package

data-lens

Source

lens.lisp (file)

Function: on FUN KEY
Package

data-lens

Source

lens.lisp (file)

Function: over FUN &key RESULT-TYPE
Package

data-lens

Source

lens.lisp (file)

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

lens.lisp (file)

Function: pick SELECTOR
Package

data-lens

Source

lens.lisp (file)

Function: regex-match REGEX
Package

data-lens

Source

lens.lisp (file)

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

lens.lisp (file)

Function: slice START &optional END
Package

data-lens

Source

lens.lisp (file)

Function: sorted COMPARATOR &rest R &key KEY
Package

data-lens

Source

lens.lisp (file)

Function: splice-elt ELT FUN
Package

data-lens

Source

lens.lisp (file)

Function: transform-elt ELT FUN
Package

data-lens

Source

lens.lisp (file)

Function: transform-head FUN
Package

data-lens

Source

lens.lisp (file)

Function: transform-tail FUN
Package

data-lens

Source

lens.lisp (file)

Function: view LENS REC

Given a lens and a rec, return the focused value

Package

data-lens.lenses

Source

lens.lisp (file)

Function: zipping RESULT-TYPE &key FILL-VALUE
Package

data-lens

Source

lens.lisp (file)


Previous: , Up: Exported definitions   [Contents][Index]

5.1.3 Generic functions

Generic Function: extract-key MAP KEY
Package

data-lens

Source

lens.lisp (file)

Methods
Method: extract-key (MAP hash-table) KEY
Method: extract-key (MAP list) KEY

Previous: , Up: Definitions   [Contents][Index]

5.2 Internal definitions


Next: , Previous: , Up: Internal definitions   [Contents][Index]

5.2.1 Macros

Macro: updatef PLACE FUN &rest ARGS
Package

data-lens

Source

lens.lisp (file)


Next: , Previous: , Up: Internal definitions   [Contents][Index]

5.2.2 Functions

Function: =>> FUN1 FUN2
Package

data-lens

Source

lens.lisp (file)

Function: cons-new &key TEST KEY
Package

data-lens

Source

lens.lisp (file)

Function: deduplicate &optional TEST
Package

data-lens

Source

lens.lisp (file)

Function: filler LENGTH1 LENGTH2 FILL-VALUE
Package

data-lens

Source

lens.lisp (file)

Function: make-alist-history-lens KEY

A lens for updating a alist, preserving previous values

Package

data-lens.lenses

Source

lens.lisp (file)

Function: matching-list-reducer TEST ACC NEXT
Package

data-lens

Source

lens.lisp (file)

Function: update THING FUN &rest ARGS
Package

data-lens

Source

lens.lisp (file)

Function: wrap-constant V
Package

data-lens.lenses

Source

lens.lisp (file)

Function: wrap-identity V
Package

data-lens.lenses

Source

lens.lisp (file)


Next: , Previous: , Up: Internal definitions   [Contents][Index]

5.2.3 Generic functions

Generic Function: clone OBJ &rest NEW-INITARGS &key
Package

data-lens.lenses

Source

lens.lisp (file)

Methods
Method: clone OBJ &rest NEW-INITARGS &key around
Generic Function: fmap FUNCTION DATA
Package

data-lens.lenses

Source

lens.lisp (file)

Methods
Method: fmap FUNCTION (DATA identity-)
Method: fmap FUNCTION (DATA constant-)
Method: fmap FUNCTION (DATA list)
Method: fmap FUNCTION (DATA vector)
Generic Function: unconstant OBJECT
Package

data-lens.lenses

Methods
Method: unconstant (CONSTANT- constant-)

automatically generated reader method

Source

lens.lisp (file)

Generic Function: unidentity OBJECT
Package

data-lens.lenses

Methods
Method: unidentity (IDENTITY- identity-)

automatically generated reader method

Source

lens.lisp (file)


Previous: , Up: Internal definitions   [Contents][Index]

5.2.4 Classes

Class: constant- ()
Package

data-lens.lenses

Source

lens.lisp (file)

Direct superclasses

standard-object (class)

Direct methods
Direct slots
Slot: %v
Initargs

:value

Readers

unconstant (generic function)

Class: identity- ()
Package

data-lens.lenses

Source

lens.lisp (file)

Direct superclasses

standard-object (class)

Direct methods
Direct slots
Slot: %v
Initargs

:value

Readers

unidentity (generic function)


Previous: , Up: Top   [Contents][Index]

Appendix A Indexes


Next: , Previous: , Up: Indexes   [Contents][Index]

A.1 Concepts

Jump to:   D   F   L  
Index Entry  Section

D
data-lens.asd: The data-lens<dot>asd file
data-lens/lens.lisp: The data-lens/lens<dot>lisp file

F
File, Lisp, data-lens.asd: The data-lens<dot>asd file
File, Lisp, data-lens/lens.lisp: The data-lens/lens<dot>lisp file

L
Lisp File, data-lens.asd: The data-lens<dot>asd file
Lisp File, data-lens/lens.lisp: The data-lens/lens<dot>lisp file

Jump to:   D   F   L  

Next: , Previous: , Up: Indexes   [Contents][Index]

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: Exported macros

=
=>>: Internal functions

A
applicable-when: Exported functions
applying: Exported macros

C
clone: Internal generic functions
clone: Internal generic functions
combine-matching-lists: Exported functions
compress-runs: Exported functions
cons-new: Internal functions
cumsum: Exported functions

D
deduplicate: Internal functions
defun-ct: Exported macros
denest: Exported functions
derive: Exported functions

E
element: Exported functions
exclude: Exported functions
extract-key: Exported generic functions
extract-key: Exported generic functions
extract-key: Exported generic functions

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

G
Generic Function, clone: Internal generic functions
Generic Function, extract-key: Exported generic functions
Generic Function, fmap: Internal generic functions
Generic Function, unconstant: Internal generic functions
Generic Function, unidentity: Internal generic functions

I
include: Exported functions

J
juxt: Exported functions

K
key: Exported functions
key-transform: Exported functions

L
let-fn: Exported macros

M
Macro, <>1: Exported macros
Macro, applying: Exported macros
Macro, defun-ct: Exported macros
Macro, let-fn: Exported macros
Macro, shortcut: Exported macros
Macro, updatef: Internal macros
make-alist-history-lens: Internal functions
make-alist-lens: Exported functions
make-hash-table-lens: Exported functions
make-plist-lens: Exported functions
matching-list-reducer: Internal functions
maximizing: Exported functions
Method, clone: Internal generic functions
Method, extract-key: Exported generic functions
Method, extract-key: Exported generic functions
Method, fmap: Internal generic functions
Method, fmap: Internal generic functions
Method, fmap: Internal generic functions
Method, fmap: Internal generic functions
Method, unconstant: Internal generic functions
Method, unidentity: Internal generic functions

O
of-length: Exported functions
of-max-length: Exported functions
of-min-length: Exported functions
on: Exported functions
over: Exported functions
over: Exported functions

P
pick: Exported functions

R
regex-match: Exported functions

S
set: Exported functions
shortcut: Exported macros
slice: Exported functions
sorted: Exported functions
splice-elt: Exported functions

T
transform-elt: Exported functions
transform-head: Exported functions
transform-tail: Exported functions

U
unconstant: Internal generic functions
unconstant: Internal generic functions
unidentity: Internal generic functions
unidentity: Internal generic functions
update: Internal functions
updatef: Internal macros

V
view: Exported functions

W
wrap-constant: Internal functions
wrap-identity: Internal functions

Z
zipping: Exported functions

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

Next: , Previous: , Up: Indexes   [Contents][Index]

A.3 Variables

Jump to:   %  
S  
Index Entry  Section

%
%v: Internal classes
%v: Internal classes

S
Slot, %v: Internal classes
Slot, %v: Internal classes

Jump to:   %  
S  

Previous: , Up: Indexes   [Contents][Index]

A.4 Data types

Jump to:   C   D   I   P   S  
Index Entry  Section

C
Class, constant-: Internal classes
Class, identity-: Internal classes
constant-: Internal classes

D
data-lens: The data-lens system
data-lens: The data-lens package
data-lens.lenses: The data-lens<dot>lenses package

I
identity-: Internal classes

P
Package, data-lens: The data-lens package
Package, data-lens.lenses: The data-lens<dot>lenses package

S
System, data-lens: The data-lens system

Jump to:   C   D   I   P   S