{"size": 1355, "ext": "scrbl", "max_stars_repo_path": "make-variable/make-variable.scrbl", "max_stars_repo_name": "bennn/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": "make-variable/make-variable.scrbl", "max_issues_repo_name": "bennn/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": "make-variable/make-variable.scrbl", "max_forks_repo_name": "bennn/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": 34.7435897436, "max_line_length": 127, "alphanum_fraction": 0.6929889299}
#lang syntax-parse-example
@require[
  (for-label racket/base racket/contract syntax/parse syntax-parse-example/make-variable/make-variable)]

@(define make-variable-eval
   (make-base-eval '(require syntax-parse-example/make-variable/make-variable)))

@title{@tt{make-variable}}
@stxbee2021["xgqt" 8]
@nested[#:style 'inset @emph{Adapted from the @hyperlink["https://gitlab.com/xgqt/racket-ebuild" @tt{racket-ebuild}] project.}]

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

@defmodule[syntax-parse-example/make-variable/make-variable]{}

@defform[(make-variable v)]{
  Formats a variable declaration for POSIX shell scripts.
  @itemlist[
    @item{When given a string or symbol, the input is the name and value of the new variable.}
    @item{When given an identifier, the identifier name is the variable name and the identifier value is the variable's value.}
  ]

  @examples[#:eval make-variable-eval
    (make-variable "this_variable_will_probably_change")
    (define Z "Zzz...")
    (make-variable Z)
  ]

  The macro uses @racket[syntax-parse] to decide how to process its input.
  It then outputs code that calls the @racket[as-variable] helper function.

  @racketfile{make-variable.rkt}

}

@defproc[(as-variable [lhs any/c] [rhs any/c]) string?]{
  Formats two values into a POSIX variable declaration.
}
