/ test / contracts / operators.aes
operators.aes
 1  // - + * / mod 	arithmetic operators
 2  // bnot band bor bxor bsl bsr 	bitwise operators
 3  // ! && || 	logical operators
 4  // == != < > =< >= 	comparison operators
 5  // :: ++ 	list operators
 6  
 7  contract Operators =
 8    entrypoint int_op(a : int, b : int, op : string) =
 9      switch(op)
10        "+"    => a + b
11        "-"    => a - b
12        "*"    => a * b
13        "/"    => a / b
14        "mod"  => a mod b
15        "^"    => a ^ b
16  
17    entrypoint bool_op(a : bool, b : bool, op : string) =
18      switch(op)
19        "!"  => !a
20        "&&" => a && b
21        "||" => a || b
22  
23    entrypoint cmp_op(a : int, b : int, op : string) =
24      switch(op)
25        "==" => a == b
26        "!=" => a != b
27        "<"  => a < b
28        ">"  => a > b
29        "=<" => a =< b
30        ">=" => a >= b
31  
32    entrypoint cons(a, l) = a :: l
33    entrypoint concat(l1, l2) = l1 ++ l2
34  
35    entrypoint hash(s) = // String.sha3(s)
36      let x = Crypto.sha3(s)
37      let y = Crypto.sha3(s)
38      (x, y)