Changes between Version 4 and Version 5 of Language


Ignore:
Timestamp:
05/17/23 21:34:31 (3 years ago)
Author:
siegel
Comment:

--

Legend:

Unmodified
Added
Removed
Modified
  • Language

    v4 v5  
    316316}}}
    317317
    318 === `$for`
     318=== Domain iteration statement: `$for`
     319
     320A domain statement has the form
     321
     322  `$for` `(``int` ''i1''`,` ...`,` ''in'' `:` ''dom''`)` ''S''
     323
     324where ''i1'', . . . , ''in'' are ''n'' identifiers, ''dom'' is an expression of type `$domain(`''n''`)`, and ''S'' is a statement.
     325The identifiers declare ''n'' variables of integer type.
     326Control iterates over the values of the domain, assigning the integer variables the components of the current tuple in the domain at the start of each iteration.
     327The scope of the variables extends to the end of ''S''.
     328The iterations takes place in the order specified by the domain, e.g., dictionary order for a Caretesian domain.
     329Note that if a range expression can be used as ''dom'' here, it will be automatically converted to a one-dimensional domain.
     330For example,
     331{{{
     332$for (int i : 0 .. 10) S
     333}}}
     334is equivalent to
     335{{{
     336$for (int i: ($domain(1)){0 .. 10}) S
     337}}}
     338
     339There is a also a parallel version of this construct, `$parfor`.
    319340
    320341=== `$parfor`