From b4f15c7ba47636eacb18673378d95fbda73e9ea8 Mon Sep 17 00:00:00 2001 From: Jack Firth Date: Fri, 4 Dec 2015 16:17:22 -0800 Subject: [PATCH] Clarify zoom lens examples --- unstable/lens/zoom.scrbl | 25 +++++++++---------------- 1 file changed, 9 insertions(+), 16 deletions(-) diff --git a/unstable/lens/zoom.scrbl b/unstable/lens/zoom.scrbl index 881007e..38e8a45 100644 --- a/unstable/lens/zoom.scrbl +++ b/unstable/lens/zoom.scrbl @@ -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)) ]} -