{"size": 1401, "ext": "scrbl", "max_stars_repo_path": "struct-list/struct-list.scrbl", "max_stars_repo_name": "maueroats/syntax-parse-example", "max_stars_repo_stars_event_min_datetime": "2017-05-18T22:15:56.000Z", "max_stars_repo_stars_event_max_datetime": "2021-09-17T13:13:05.000Z", "max_issues_repo_path": "struct-list/struct-list.scrbl", "max_issues_repo_name": "maueroats/syntax-parse-example", "max_issues_repo_issues_event_min_datetime": "2017-05-18T22:54:53.000Z", "max_issues_repo_issues_event_max_datetime": "2021-10-19T02:58:50.000Z", "max_forks_repo_path": "struct-list/struct-list.scrbl", "max_forks_repo_name": "maueroats/syntax-parse-example", "max_forks_repo_forks_event_min_datetime": "2017-05-19T14:27:57.000Z", "max_forks_repo_forks_event_max_datetime": "2022-03-30T09:36:54.000Z"}
{"max_stars_count": 22, "max_issues_count": 20, "max_forks_count": 6, "avg_line_length": 33.3571428571, "max_line_length": 173, "alphanum_fraction": 0.6545324768}
#lang syntax-parse-example
@require[
  (for-label typed/racket/base racket/syntax syntax/parse syntax-parse-example/struct-list/struct-list)]

@(define struct-list-eval
   (make-base-eval #:lang 'typed/racket/base '(require syntax-parse-example/struct-list/struct-list)))

@title{@tt{struct-list}}

@; =============================================================================

@defmodule[syntax-parse-example/struct-list/struct-list]{}

@defform[(struct-list expr ...)]{
  The @racket[struct-list] macro has similar syntax as Typed Racket's @racket[struct] form, but creates a new datatype backed by a @racket[list] instead of an actual struct.
  The only cosmetic difference is that type @racket[#:type-name] keyword is required, and must supply a name that is different from the struct name.

  @examples[#:eval struct-list-eval
   (struct-list foo ([a : String] [b : String]) #:type-name Foo)
   (define f (foo "hello" "world"))
   (foo? f)
   (string-append (foo-a f) " " (foo-b f))
   (ann f Foo)
  ]

  The implementation:
  @itemlist[#:style 'ordered
    @item{
      extracts the names and type names from the syntax,
    }
    @item{
      creates an identifier for the predicate and a sequence of identifiers for the accessors (see the @racket[#:with] clauses),
    }
    @item{
      and defines a constructor and predicate and accessor(s).
    }
  ]

  @racketfile{struct-list.rkt}

}
