{"size": 1140, "ext": "scrbl", "max_stars_repo_path": "lens-doc/unstable/lens/struct-join.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/unstable/lens/struct-join.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/unstable/lens/struct-join.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": 39.3103448276, "max_line_length": 75, "alphanum_fraction": 0.6780701754}
#lang scribble/manual

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

@title{Joining lenses with structs}

@defform[(lens-join/struct struct-id field-lens ...)
         #:grammar ([field-lens (code:line lens-expr)
                                (code:line field-keyword lens-expr)])]{
Like @racket[lens-join/list], except that the views of the given
lenses are put in an instance of the @racket[struct-id] struct instead
of in a list.
@lens-unstable-examples[
  (struct foo (a b) #:transparent)
  (define lens (lens-join/struct foo first-lens third-lens))
  (lens-view lens '(1 2 3))
  (lens-set lens '(1 2 3) (foo 'a 'b))
]
Struct fields in a @racket[lens-join/struct] form can also be
specified by keywords, in any order, and even with some fields specied
by position and some by keywords:
@lens-unstable-examples[
  (struct foo (a b) #:transparent)
  (lens-view (lens-join/struct foo first-lens third-lens) '(1 2 3))
  (lens-view (lens-join/struct foo #:a first-lens #:b third-lens) '(1 2 3))
  (lens-view (lens-join/struct foo #:b third-lens #:a first-lens) '(1 2 3))
  (lens-view (lens-join/struct foo first-lens #:b third-lens) '(1 2 3))
]}
