Merge pull request #137 from AlexKnauth/fix

Clean up docs
This commit is contained in:
Jack Firth 2015-07-18 10:45:07 -07:00
commit 19ea693eee
6 changed files with 15 additions and 17 deletions

View File

@ -18,10 +18,10 @@
(define-examples-form lenses-examples (define-examples-form lenses-examples
lens racket/list) lens racket/list racket/stream)
(define-examples-form lenses-applicable-examples (define-examples-form lenses-applicable-examples
lens/applicable racket/list) lens/applicable racket/list racket/stream)
(define-examples-form lenses-unstable-examples (define-examples-form lenses-unstable-examples
lens unstable/lens racket/list) lens unstable/lens racket/list racket/stream)

View File

@ -7,6 +7,7 @@
unstable/lens unstable/lens
racket/base racket/base
racket/list racket/list
racket/stream
racket/contract racket/contract
) )
(for-syntax racket/base (for-syntax racket/base
@ -24,6 +25,7 @@
unstable/lens unstable/lens
racket/base racket/base
racket/list racket/list
racket/stream
racket/contract racket/contract
)) ))
(for-syntax (all-from-out (for-syntax (all-from-out

View File

@ -16,7 +16,7 @@ switched, so that the @racket[target] comes first and the
@racket[(lens-view (lens-thrush lens ...) target)], but can be more @racket[(lens-view (lens-thrush lens ...) target)], but can be more
efficient. 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[ @lenses-unstable-examples[
(lens-view/thrush '(a b ((c d) e f) g) third-lens first-lens second-lens) (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)
]} ]}
@ -28,7 +28,7 @@ which again are combined into a nested lens.
@racket[(lens-set/thrush target lens ... #:-> new-view)] is equivalent @racket[(lens-set/thrush target lens ... #:-> new-view)] is equivalent
to @racket[(lens-set (lens-thrush lens ...) target new-view)], and 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[ @lenses-unstable-examples[
(lens-set/thrush '(a b ((c d) e f) g) third-lens first-lens second-lens #:-> "sea") (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")
]} ]}
@ -45,7 +45,7 @@ just like @racket[lens-set/thrush].
equivalent to equivalent to
@racket[(lens-transform (lens-thrush lens ...) target transformer)], @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[ @lenses-unstable-examples[
(lens-transform/thrush '(a b ((c d) e f) g) third-lens first-lens second-lens #:-> symbol->string) (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)
]} ]}

View File

@ -11,6 +11,6 @@ Creates a lens that views a subset of the target hash-table with the given
@racket[key]s. The view, is another hash-table with only the given keys and @racket[key]s. The view, is another hash-table with only the given keys and
their corrosponding values in the target hash-table. their corrosponding values in the target hash-table.
@lenses-unstable-examples[ @lenses-unstable-examples[
(lens-view (hash-slice-lens 'a 'c) (hash 'a 1 'b 2 'c 3)) (lens-view (hash-pluck-lens 'a 'c) (hash 'a 1 'b 2 'c 3))
(lens-set (hash-slice-lens 'a 'c) (hash 'a 1 'b 2 'c 3) (hash 'a 4 'c 5)) (lens-set (hash-pluck-lens 'a 'c) (hash 'a 1 'b 2 'c 3) (hash 'a 4 'c 5))
]} ]}

View File

@ -16,8 +16,6 @@ Like @racket[list-refs-lens], but for strings.
Equivalent to @racket[(lens-join/string (string-ref-lens i) ...)]. Equivalent to @racket[(lens-join/string (string-ref-lens i) ...)].
@lenses-unstable-examples[ @lenses-unstable-examples[
(define 1-5-6-lens (string-pluck-lens 1 5 6)) (define 1-5-6-lens (string-pluck-lens 1 5 6))
(check-equal? (lens-view 1-5-6-lens "abcdefg") (lens-view 1-5-6-lens "abcdefg")
"bfg") (lens-set 1-5-6-lens "abcdefg" "BFG")
(check-equal? (lens-set 1-5-6-lens "abcdefg" "BFG")
"aBcdeFG")
]} ]}

View File

@ -8,7 +8,7 @@
Returns a lens that views an element of a vector. Returns a lens that views an element of a vector.
@lenses-unstable-examples[ @lenses-unstable-examples[
(lens-view (vector-ref-lens 2) #(a b c d)) (lens-view (vector-ref-lens 2) #(a b c d))
(lens-set (vector-ref lens 2) #(a b c d) "sea") (lens-set (vector-ref-lens 2) #(a b c d) "sea")
]} ]}
@defproc[(vector-ref-nested-lens [i exact-nonnegative-integer?] ...) lens?]{ @defproc[(vector-ref-nested-lens [i exact-nonnegative-integer?] ...) lens?]{
@ -24,8 +24,6 @@ Like @racket[list-refs-lens], but for vectors.
Equivalent to @racket[(lens-join/vector (vector-ref-lens i) ...)]. Equivalent to @racket[(lens-join/vector (vector-ref-lens i) ...)].
@lenses-unstable-examples[ @lenses-unstable-examples[
(define 1-5-6-lens (vector-pluck-lens 1 5 6)) (define 1-5-6-lens (vector-pluck-lens 1 5 6))
(check-equal? (lens-view 1-5-6-lens #(a b c d e f g)) (lens-view 1-5-6-lens #(a b c d e f g))
#(b f g)) (lens-set 1-5-6-lens #(a b c d e f g) #(1 2 3))
(check-equal? (lens-set 1-5-6-lens #(a b c d e f g) #(1 2 3))
#(a 1 c d e 2 3))
]} ]}