next up previous
Next: Dependent Types Up: An introduction to the ALDOR Previous: Variables and Constants

Sequencing

Examples.
      (a: Integer)..(b: Integer): Generator Integer == generate {
           while a <= b repeat { yield a; a := a + 1 }
       }
       map(f: T -> T)(x: %): %  == {
           xx := rep x;
           yy: Rep := new(dim);
           for i in a..b repeat set!(yy, i, f (xx.i));
           per(yy);
       }
       << (port:BinaryReader):% == {
             p:% := 0;
             local e:E;
             local r:R;
             repeat {
                   r := << port;
                   e := << port;
                   zero? r => break;
                   p := add!(p, r, e);
             }
             p;
       }


next up previous
Next: Dependent Types Up: An introduction to the ALDOR Previous: Variables and Constants
Marc Moreno Maza
2003-06-06