First test work commit, don't touch
This commit is contained in:
@@ -0,0 +1,44 @@
|
||||
// - + * / mod arithmetic operators
|
||||
// bnot band bor bxor bsl bsr bitwise operators
|
||||
// ! && || logical operators
|
||||
// == != < > =< >= comparison operators
|
||||
// :: ++ list operators
|
||||
|
||||
contract Operators =
|
||||
function int_op(a : int, b : int, op : string) =
|
||||
switch(op)
|
||||
"+" => a + b
|
||||
"-" => a - b
|
||||
"*" => a * b
|
||||
"/" => a / b
|
||||
"mod" => a mod b
|
||||
"^" => a ^ b
|
||||
"bnot" => bnot a
|
||||
"band" => a band b
|
||||
"bor" => a bor b
|
||||
"bxor" => a bxor b
|
||||
"bsl" => a bsl b
|
||||
"bsr" => a bsr b
|
||||
|
||||
function bool_op(a : bool, b : bool, op : string) =
|
||||
switch(op)
|
||||
"!" => !a
|
||||
"&&" => a && b
|
||||
"||" => a || b
|
||||
|
||||
function cmp_op(a : int, b : int, op : string) =
|
||||
switch(op)
|
||||
"==" => a == b
|
||||
"!=" => a != b
|
||||
"<" => a < b
|
||||
">" => a > b
|
||||
"=<" => a =< b
|
||||
">=" => a >= b
|
||||
|
||||
function cons(a, l) = a :: l
|
||||
function concat(l1, l2) = l1 ++ l2
|
||||
|
||||
function hash(s) = // String.sha3(s)
|
||||
let x = String.sha3(s)
|
||||
let y = String.sha3(s)
|
||||
(x, y)
|
||||
Reference in New Issue
Block a user