{"size": 1310, "ext": "scrbl", "max_stars_repo_path": "lens-doc/lens/private/base/view-set.scrbl", "max_stars_repo_name": "AlexKnauth/lens", "max_stars_repo_stars_event_min_datetime": "2015-07-08T12:56:46.000Z", "max_stars_repo_stars_event_max_datetime": "2022-03-17T21:21:54.000Z", "max_issues_repo_path": "lens-doc/lens/private/base/view-set.scrbl", "max_issues_repo_name": "AlexKnauth/lens", "max_issues_repo_issues_event_min_datetime": "2015-07-07T01:47:59.000Z", "max_issues_repo_issues_event_max_datetime": "2019-09-10T18:35:17.000Z", "max_forks_repo_path": "lens-doc/lens/private/base/view-set.scrbl", "max_forks_repo_name": "AlexKnauth/lens", "max_forks_repo_forks_event_min_datetime": "2015-07-07T05:01:29.000Z", "max_forks_repo_forks_event_max_datetime": "2019-07-16T00:37:04.000Z"}
{"max_stars_count": 66, "max_issues_count": 199, "max_forks_count": 11, "avg_line_length": 31.1904761905, "max_line_length": 92, "alphanum_fraction": 0.6290076336}
#lang scribble/manual

@(require lens/private/doc-util/main)


@title{Viewing and Setting}

@defproc[(lens-view [lens lens?] [target target/c]) view/c]{
  Extracts the view of @racket[target] with @racket[lens].
  Essentially a getter function.
  @lens-examples[
    (lens-view first-lens '(1 2 3))
]}

@defproc[(lens-set [lens lens?] [target target/c] [new-view view/c]) target/c]{
  Sets the view of @racket[target] to @racket[new-view] using
  @racket[lens]. Essentially a setter function.
  @lens-examples[
    (lens-set first-lens '(1 2 3) 'a)
]}

@defproc[(lens-view/list [target target/c] [lens lens?] ...) view/c]{
  Like @racket[lens-view], except that it takes multiple lenses and
  returns a list of views.
  @lens-examples[
    (lens-view/list '(a b c d e f g)
                    first-lens fourth-lens fifth-lens)
]}

@defproc[(lens-set/list [target target/c] [lens lens?] [new-view view/c] ... ...) target/c]{
  Like @racket[lens-set], except that it can take multiple
  lenses-value pairs. If the view of two of the lenses overlap, the
  later views overwrite the earlier ones.
  @lens-examples[
    (lens-set/list '(1 2 3 4 5)
                   first-lens 10
                   third-lens 300)
    (lens-set/list '(1 2 3)
                   first-lens 'a
                   first-lens 'b)
]}
