On this page:
%
in
define%
17.1 Untyped versions of percent
9.2.900

17 let-in binding and destructuring form🔗ℹ

 (require phc-toolkit/percent) package: phc-toolkit

The forms in this module may possibly be moved to a separate package, as part of the template library described in Versatile parser and template library (for now the template library is not implemented yet).

syntax

(% parallel-binding …
   maybe-in
   body …)
 
parallel-binding = binding and parallel-binding
  | binding
     
binding = pattern … = expr
     
maybe-in = 
  | in
     
expr = expression
Locally binds the variables in the patterns to the expr. Each binding clause should contain as many patterns as expr produces values. The body … forms are evaluated with the given variables bound.

The bindings are executed in sequence, as if bound with let*, unless grouped using and, in which case they are executed in parallel, as if bound with let.

NOTE: TODO: for now bindings are run in sequence, and parallel bindings have not been implemented yet.

syntax

in

This identifier is only valid in certain forms, like (% x = 10 in (+ x x)). It is an error to use it as an expression otherwise.

syntax

(define% (name pattern …)
  body …)
 
pattern = variable
  | [variable : type]
  | cons-pattern
  | list-pattern
  | vector-pattern
     
cons-pattern = (pattern . pattern)
  | (pattern :: pattern)
     
list-pattern = (pattern …)
  | (pattern … :: tail-pattern)
     
tail-pattern = pattern
     
vector-pattern = #(pattern …)
     
variable = identifier
Locally binds the variables in the patterns to the expr. Each binding clause should contain as many patterns as expr produces values. The body … forms are evaluated with the given variables bound.

The bindings are executed in parallel, as if bound with let.

17.1 Untyped versions of percent🔗ℹ

 (require phc-toolkit/untyped/percent) package: phc-toolkit