Clarify zoom lens examples

This commit is contained in:
Jack Firth 2015-12-04 16:17:22 -08:00
parent 7dcd985f16
commit b4f15c7ba4

View File

@ -15,13 +15,10 @@ is equivalent to:
@racketblock[(lens-transform zoom-lens target (λ (v) (lens-view transform-lens v)))]
@lens-unstable-examples[
(define first-sym->str
(lens-zoom first-lens symbol->string-lens))
(lens-view first-sym->str '(a b c))
(lens-set first-sym->str '(a b c) '("a" b c))
(lens-set first-sym->str '(a b c) '("z" b c))
(lens-set first-sym->str '(a b c) '("z" bee sea))
(lens-view first-sym->str (lens-set first-sym->str '(a b c) '("z" bee sea)))
(define first-zoom-second-lens
(lens-zoom first-lens second-lens))
(lens-view first-zoom-second-lens '((1 2 3) b c))
(lens-set first-zoom-second-lens '((1 2 3) b c) '(2000 b FOO))
]}
@defproc[(lens-zoom* [zoom-lens lens?] [transform-lens lens?] ... ...) lens?]{
@ -29,13 +26,9 @@ A multi-arg version of @racket[lens-zoom], analogous to
@racket[lens-transform/list]. It is equivalent to
@racket[(lens-thrush (lens-zoom zoom-lens transform-lens) ...)].
@lens-unstable-examples[
(define first-sym->str/second-num->str
(lens-zoom* first-lens symbol->string-lens second-lens number->string-lens))
(lens-view first-sym->str/second-num->str '(a 2 c))
(lens-set first-sym->str/second-num->str '(a 2 c) '("a" "2" c))
(lens-set first-sym->str/second-num->str '(a 2 c) '("z" "3" c))
(lens-set first-sym->str/second-num->str '(a 2 c) '("z" "3" sea))
(lens-view first-sym->str/second-num->str
(lens-set first-sym->str/second-num->str '(a 2 c) '("z" "3" sea)))
(define first-zoom-second/third-zoom-first-lens
(lens-zoom* first-lens second-lens
third-lens first-lens))
(lens-view first-zoom-second/third-zoom-first-lens '((1 2 3) foo (a b c)))
(lens-set first-zoom-second/third-zoom-first-lens '((1 2 3) foo (a b c)) '(200 FOO asdf))
]}