Next: Exported generic functions, Previous: Exported macros, Up: Exported definitions [Contents][Index]
A lens for updating a alist, discarding previous values
lens.lisp (file)
A lens for updating a hash-table, discarding previous values
lens.lisp (file)
A lens for updating a plist, preserving previous values
lens.lisp (file)
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.
lens.lisp (file)
Given a lens, a value and a rec, immutably update the rec to
contain the new value at the location focused by the lens.
lens.lisp (file)
Given a lens and a rec, return the focused value
lens.lisp (file)
Next: Exported generic functions, Previous: Exported macros, Up: Exported definitions [Contents][Index]