{"size": 1687, "ext": "scrbl", "max_stars_repo_path": "sweet-exp-utils/docs/sweet-exp-utils-kw-let.scrbl", "max_stars_repo_name": "AlexKnauth/sweet-exp-utils", "max_stars_repo_stars_event_min_datetime": "2015-03-08T01:15:11.000Z", "max_stars_repo_stars_event_max_datetime": "2015-03-08T01:15:11.000Z", "max_issues_repo_path": "sweet-exp-utils/docs/sweet-exp-utils-kw-let.scrbl", "max_issues_repo_name": "AlexKnauth/sweet-exp-utils", "max_issues_repo_issues_event_min_datetime": null, "max_issues_repo_issues_event_max_datetime": null, "max_forks_repo_path": "sweet-exp-utils/docs/sweet-exp-utils-kw-let.scrbl", "max_forks_repo_name": "AlexKnauth/sweet-exp-utils", "max_forks_repo_forks_event_min_datetime": null, "max_forks_repo_forks_event_max_datetime": null}
{"max_stars_count": 1, "max_issues_count": null, "max_forks_count": null, "avg_line_length": 26.359375, "max_line_length": 79, "alphanum_fraction": 0.617071725}
#lang scribble/manual
@(require scribble/eval
          scribble-code-examples
          (for-label sweet-exp-utils/kw-let
                     racket
                     (only-in lang/htdp-advanced recur)
                     ))

@title{sweet-exp-utils/kw-let}

@defmodule[sweet-exp-utils/kw-let]

@defform[(kw-let kw expr ... ... body ...+)]{
Similar to @racket[let], except that instead of a parenthesized list of binding
pairs, it takes the identifiers as keywords.  This is especially useful within
a module with the @racketmodname[sweet-exp] meta-language.

@examples[
  (require sweet-exp-utils/kw-let)
  (kw-let #:a 1 #:b 2
    (+ a b))
]
@code-examples[#:lang "sweet-exp racket" #:context #'here #:show-lang-line #t]{
require sweet-exp-utils/kw-let
kw-let #:a 1 #:b 2
  {a + b}
kw-let
  #:a lambda (x)
        {x + 1}
  #:b 2
  a(b)
}
}

@deftogether[[
  @defform[(kw-let* kw expr ... ... body ...+)]
  @defform[(kw-letrec kw expr ... ... body ...+)]
]]{
Like @racket[kw-let], but behaving like @racket[let*] and @racket[letrec].
}

@defform[(kw-recur loop-id kw expr ... ... body ...+)]{
Similar in spirit to the named variant of @racket[let], or to @racket[recur]
from ASL, but replacing the list of binding pairs with a sequence of keywords,
and also defining @racket[loop-id] as a function that takes keyword arguments,
instead of positional arguments.

@examples[
  (require sweet-exp-utils/kw-let)
  (kw-recur fac #:n 10
    (if (zero? n)
        1
        (* n (fac #:n (sub1 n)))))
]
@code-examples[#:lang "sweet-exp racket" #:context #'here #:show-lang-line #t]{
require sweet-exp-utils/kw-let
kw-recur fac #:n 10
  if zero?(n)
     1
     {n * fac(#:n {n - 1})}
}
}

