/ groups / src / main.adl
main.adl
 1  program groups.alpha {
 2      // This function takes a group coordinate as input `a` and performs several operations which should output the `0group`.
 3      // Note that the operations can be called as associated functions on the `a` variable.
 4  
 5      transition main(a: group) -> group {
 6          // unary
 7          let b: group = a.double(); // 2a
 8          let c: group = b.neg();    // -2a
 9  
10          // binary
11          let d: group = (a * 2scalar).add(c);
12  
13          // generator
14          let e: group = group::GEN;
15  
16          return d + e;
17      }
18  
19      // The constructor is configured to prevent upgrades.
20      @noupgrade
21      async constructor() {}
22  }
23