www

Unnamed repository; edit this file 'description' to name the repository.
Log | Files | Refs | Submodules | README | LICENSE

percent.scrbl (2400B)


      1 #lang scribble/manual
      2 
      3 @(require (for-label typed/racket/base
      4                      phc-toolkit/percent))
      5 
      6 @title{@racket[let-in] binding and destructuring form}
      7 
      8 @defmodule[phc-toolkit/percent]
      9 
     10 The forms in this module may possibly be moved to a separate
     11 package, as part of the template library described in 
     12 @secref{template-lib} (for now the template library is not
     13 implemented yet).
     14 
     15 @defform[#:literals (in = and)
     16          (% parallel-binding …
     17             maybe-in
     18             body …)
     19          #:grammar
     20          [(parallel-binding (code:line binding and parallel-binding)
     21                             binding)
     22           (binding (code:line pattern … = expr))
     23           (maybe-in (code:line)
     24                     in)
     25           (expr expression)]]{
     26  Locally binds the variables in the @racket[pattern]s to the
     27  @racket[expr]. Each binding clause should contain as many 
     28  @racket[pattern]s as @racket[expr] produces values. The 
     29  @racket[body …] forms are evaluated with the given
     30  variables bound.
     31 
     32  The bindings are executed in sequence, as if bound with 
     33  @racket[let*], unless grouped using @racket[and], in which
     34  case they  are executed in parallel, as if bound with 
     35  @racket[let].
     36 
     37  NOTE: TODO: for now bindings are run in sequence, and
     38  parallel bindings have not been implemented yet.}
     39 
     40 @defidform[in]{
     41  This identifier is only valid in certain forms, like 
     42  @racket[(% x = 10 in (+ x x))]. It is an error to use it as
     43  an expression otherwise.}
     44 
     45 @defform[#:literals (: :: …)
     46          (define% (name pattern …)
     47            body …)
     48          #:grammar
     49          [(pattern variable
     50                    [variable : type]
     51                    cons-pattern
     52                    list-pattern
     53                    vector-pattern)
     54           (cons-pattern (pattern . pattern)
     55                         (pattern :: pattern))
     56           (list-pattern (pattern …)
     57                         (pattern … :: tail-pattern))
     58           (tail-pattern pattern)
     59           (vector-pattern #(pattern …))
     60           (variable identifier)]]{
     61  Locally binds the variables in the @racket[pattern]s to the
     62  @racket[expr]. Each binding clause should contain as many 
     63  @racket[pattern]s as @racket[expr] produces values. The 
     64  @racket[body …] forms are evaluated with the given
     65  variables bound.
     66 
     67  The bindings are executed in parallel, as if bound with 
     68  @racket[let].}
     69 
     70 @include-section{percent-untyped.scrbl}