glasses.traversals

->traversal

(->traversal lens)
coerce a lens or a traversal into a traversal
if given a traversal its a noop
if given a lens it returns a traversal of the 1 item the lens points to

concat

(concat lenses)
takes a list of lenses/traversals and returns a
traversal that is the `concated` traversal of all of them.

view gives you all traversed items in the order of the lenses
update writes to all travesed items in the order of the lenses

filtered

(filtered pred?)
given a predicate gives you a traversal over
the items of a seq that matches the predicate

Examples:
(= (lens/update [1 2 3] (filtered odd?) inc)
   [2 2 4])

mapped

a traversal over a seq of items

Example:
(= (lens/update [1 2 3] mapped inc)
   [2 3 4])

mapped-vals

a traversal over values in a map

Example:
(= (lens/update {:a 1, :b 2} mapped-vals inc)
   {:a 2, :b 3})

shrink

(shrink pred?)
given a predicate shrink returns a traversal of 1 item
that either includes the item or ignores the item.

Examples:
(= (lens/update 1 (shrink odd?) inc) 2)
(= (lens/update 1 (shrink even?) inc) 1)

(= (lens/update [1 2 3] [mapped (shrink even?)] inc)
   [1 3 3])