glasses

->Lens

(->Lens f lens-name-f)
Positional factory function for class glasses.Lens.

->Traversals

(->Traversals f lens-name-f)
Positional factory function for class glasses.Traversals.

assoc-lens

(assoc-lens key)
assoc lens takes a key and returns a lens
that points to the value of any associtive structure
that is associated with that key

comp-lenses

(comp-lenses lenses)
takes a list of lenses and composes them from first to last

extract

(extract lens-map)
extract takes a map where the values are lenses
from the same root to different or the same fields.
And returns a lens
The lens is a lens from the shared root of the input lenses
to a map where the values are the fields the lenses pointed to.
changes to these values are updated in the original root when updated
in the map

find-lens

(find-lens f & [lens-name])
takes a function from a root to a lens for that root.
And returns a lens where the field is the field of the lens
returned by the function

flatten-lenses

(flatten-lenses lenses)
takes a list of lenses from the same root and returns a lens.
where the field is a list of all fields in the given list.
updates to these fields are reflected in the given root

getter-setter-lens

(getter-setter-lens getter setter & [lens-name])
takes a getter and a setter function and returns a lens

id

the id lens is a lens that is a lens of the root itself.
if viewed it returns the root. And if uppdated it updates the root.

ignore

ignore is a traversal that returns no items if viewed
and ignores the function given if updated

iso-lens

(iso-lens a->b b->a)
takes 2 functions that can convert a value back and forth.
And returns a lens that where the field is the converted value

lens

(lens f & [lens-name-f])
takes a "lens function" and returns a lens
a lens function is a function that given a root
returns a pair where the first item is the field the lens points to
and the second item is a function that given a function returns a new
root with the field updated

also takes a optional function `lens-name-f` that is called when
the lens is printed

traversal

(traversal f & [lens-name-f])
takes a "traversal function" and returns a traversal

a traversal function is a function that takes a root
and returns a pair.
The first item in that pair is a seq of all items that the traversal
points to.
And the second item in that pair is a function, that given a function of the items
traversed returns a new root with the items updated by that function

update

(update root lens f & args)
takes a root a lens and a function (and optional extra arguments to that function)
and returns a new root with the field that the lens points to updated with the given function.

view

(view root lens)
takes a root and a lens and returns the field
that the lens points to

write

(write root lens value)
takes a root, lens and a value and replaces the field the lens points
to with that value