From b92414290044ea82adf3ddef2c347b9e2cf5d3cd Mon Sep 17 00:00:00 2001 From: AlexKnauth Date: Mon, 13 Jul 2015 09:34:50 -0400 Subject: [PATCH] rename to use ~> instead of -> --- unstable/lens/arrow.rkt | 24 ++++++++++++------------ unstable/lens/arrow.scrbl | 18 +++++++++--------- 2 files changed, 21 insertions(+), 21 deletions(-) diff --git a/unstable/lens/arrow.rkt b/unstable/lens/arrow.rkt index d09e2bb..ae6373c 100644 --- a/unstable/lens/arrow.rkt +++ b/unstable/lens/arrow.rkt @@ -1,8 +1,8 @@ #lang racket/base -(provide lens-view-> - lens-set-> - lens-transform-> +(provide lens-view~> + lens-set~> + lens-transform~> lens-view/thrush lens-set/thrush lens-transform/thrush @@ -12,19 +12,19 @@ (module+ test (require rackunit racket/list fancy-app)) -(define (lens-view-> target . lenses) +(define (lens-view~> target . lenses) (for/fold ([target target]) ([lens (in-list lenses)]) (lens-view lens target))) -(define (lens-set-> target #:-> new-val . lenses) +(define (lens-set~> target #:-> new-val . lenses) (lens-set (apply lens-thrush lenses) target new-val)) -(define (lens-transform-> target #:-> transformer . lenses) +(define (lens-transform~> target #:-> transformer . lenses) (lens-transform (apply lens-thrush lenses) target transformer)) -(define lens-view/thrush lens-view->) -(define lens-set/thrush lens-set->) -(define lens-transform/thrush lens-transform->) +(define lens-view/thrush lens-view~>) +(define lens-set/thrush lens-set~>) +(define lens-transform/thrush lens-transform~>) (module+ test (define (set-first l v) @@ -33,10 +33,10 @@ (list* (first l) v (rest (rest l)))) (define first-lens (make-lens first set-first)) (define second-lens (make-lens second set-second)) - (check-equal? (lens-view-> '((1 2) 3) first-lens second-lens) + (check-equal? (lens-view~> '((1 2) 3) first-lens second-lens) 2) - (check-equal? (lens-set-> '((1 2) 3) first-lens second-lens #:-> 'two) + (check-equal? (lens-set~> '((1 2) 3) first-lens second-lens #:-> 'two) '((1 two) 3)) - (check-equal? (lens-transform-> '((1 2) 3) first-lens second-lens #:-> (* 100 _)) + (check-equal? (lens-transform~> '((1 2) 3) first-lens second-lens #:-> (* 100 _)) '((1 200) 3)) ) diff --git a/unstable/lens/arrow.scrbl b/unstable/lens/arrow.scrbl index dd8499b..4134ae8 100644 --- a/unstable/lens/arrow.scrbl +++ b/unstable/lens/arrow.scrbl @@ -7,7 +7,7 @@ @defmodule[unstable/lens/arrow] @deftogether[[@defproc[(lens-view/thrush [target any/c] [lens lens?] ...) any/c] - @defproc[(lens-view-> [target any/c] [lens lens?] ...) any/c]]]{ + @defproc[(lens-view~> [target any/c] [lens lens?] ...) any/c]]]{ Like @racket[lens-view], except that it can take multiple lenses, which are combined into a nested lens. The argument order is switched, so that the @racket[target] comes first and the @@ -15,28 +15,28 @@ switched, so that the @racket[target] comes first and the @racket[(lens-view/thrush target lens ...)] produces the same value as @racket[(lens-view (lens-thrush lens ...) target)], but can be more efficient. -The function @racket[lens-view->] is provided as a shorter version. +The function @racket[lens-view~>] is provided as a shorter version. @lenses-examples[ (lens-view/thrush '(a b ((c d) e f) g) third-lens first-lens second-lens) - (lens-view-> '(a b ((c d) e f) g) third-lens first-lens second-lens) + (lens-view~> '(a b ((c d) e f) g) third-lens first-lens second-lens) ]} @deftogether[[@defproc[(lens-set/thrush [target any/c] [lens lens?] ... [#:-> new-view any/c]) any/c] - @defproc[(lens-set-> [target any/c] [lens lens?] ... [#:-> new-view any/c]) any/c]]]{ + @defproc[(lens-set~> [target any/c] [lens lens?] ... [#:-> new-view any/c]) any/c]]]{ Like @racket[lens-set], except that it can take multiple lenses, which again are combined into a nested lens. @racket[(lens-set/thrush target lens ... #:-> new-view)] is equivalent to @racket[(lens-set (lens-thrush lens ...) target new-view)], and -@racket[lens-set->] is the shorter version. +@racket[lens-set~>] is the shorter version. @lenses-examples[ (lens-set/thrush '(a b ((c d) e f) g) third-lens first-lens second-lens #:-> "sea") - (lens-set-> '(a b ((c d) e f) g) third-lens first-lens second-lens #:-> "sea") + (lens-set~> '(a b ((c d) e f) g) third-lens first-lens second-lens #:-> "sea") ]} @deftogether[[@defproc[(lens-transform/thrush [target any/c] [lens lens?] ... [#:-> transformer (-> any/c any/c)]) any/c] - @defproc[(lens-transform-> [target any/c] [lens lens?] ... + @defproc[(lens-transform~> [target any/c] [lens lens?] ... [#:-> transformer (-> any/c any/c)]) any/c]]]{ Like @racket[lens-transform], except that it can take multiple lenses, @@ -44,9 +44,9 @@ just like @racket[lens-set/thrush]. @racket[(lens-transform/thrush target lens ... #:-> transformer)] is equivalent to @racket[(lens-transform (lens-thrush lens ...) target transformer)], -and @racket[lens-transform->] is the shorter verison. +and @racket[lens-transform~>] is the shorter verison. @lenses-examples[ (lens-transform/thrush '(a b ((c d) e f) g) third-lens first-lens second-lens #:-> symbol->string) - (lens-transform-> '(a b ((c d) e f) g) third-lens first-lens second-lens #:-> symbol->string) + (lens-transform~> '(a b ((c d) e f) g) third-lens first-lens second-lens #:-> symbol->string) ]}