concrete-optics.base

Core and derived optic capabilites and composition.

compose

(compose & optics)

General optic composition. Accepts an arbitrary list of optics. It produces the eq, the unit on optic composition, for the empty list.

over

(over optic transformation whole)

Lifts a transformation over the part to a transformation on the whole. If the optic does not have the over capability then it throws an exception.

preview

(preview optic whole)

Tries to focus on a sinlge element, produces :no-match if it fails. Note that the failure to find the element does not result in nil because that would break (predicate-prism nil?). If the optic does not have the to-list capability then it throws an exception because preview is defined in terms of to-list.

put

(put optic focus whole)

Replaces the element in the whole by the new focus. Traditionally called set but it clashes with the data structure set. If the optic does not have the over capability then it throws an exception because put is defined in terms of over.

review

(review optic part)

Generates a whole from a given part. If the optic does not have the review capability then it throws an exception.

to-list

(to-list optic whole)

Given an optic and a whole, returns the focus list. If the optic does not have the to-list capability then it throws an exception.

traverse

(traverse optic applicative part-processor whole)

Reduces a collection inside an applicative. If the optic does not have the traverse capability then it throes an exception.

view

(view optic whole)

Given an optic and a whole, returns the focus. If the optic does not have the view capability then it throws an exception.