For now clojure functions implement lens in a trivial way. Beside being quite handy, it do not feels particularly right. Given the definition of lenses of the docs: “A lens a well know abstraction that is used to get a certain view of a datastructure and potentially update this view, repercuting back the changes to the original datastructure.” The repercution part is not handled by the the default function impl. As an example, let’s look at the `next` lens:
(in-ns 'monk.core)
(let [L (lens/mk
c/next
;; The update function is taking care of preserving the head of the given seq.
(fn [s f] (send s (> c/next f (f_ (c/cons (c/first s) _))))))]
(upd (c/range 10)
L
($ c/inc)))
The old question of false
Should it be considered truthy?
Booleans are valuable data that should be decoupled from control flow ?
For now false is not allowed and short-circuits the execution.
This was originally intended to ease clojure integration but do not seems to still be necessary.
The wrapping of clojure predicates into guards now occurs in monk.core
.
created false-is-a-value
branch
Currently monk is intended to be ‘used’. It is not a common practice in the clojure community for good reasons. It conflicts with many tools and is not clojurescript friendly.
the upd implementation of those lenses is very discutable and certainly incorrect. the upd method expects a item level update, it should take a collection update.