{
'in' => infix(0) do |a,b|
raise(RuntimeError, 'Unit support not available') if !a.respond_to? :in
a.in(b)
end,
'||' => infix(1) {|a,b| a || b },
'&&' => infix(2) {|a,b| a && b },
'==' => infix(3) {|a,b| a == b },
'!=' => infix(3) {|a,b| a != b },
'<=' => infix(3) {|a,b| a <= b },
'>=' => infix(3) {|a,b| a >= b },
'<' => infix(3) {|a,b| a < b },
'>' => infix(3) {|a,b| a > b },
'+' => infix(4, 'plus') {|a,b| a + b },
'-' => infix(4, 'minus') {|a,b| a - b },
'>>' => infix(5) {|a,b| a >> b },
'<<' => infix(5) {|a,b| a << b },
'&' => infix(6) {|a,b| a & b },
'|' => infix(6) {|a,b| a | b },
'^' => infix(6) {|a,b| a ^ b },
'*' => infix(7) {|a,b| a * b },
'/' => infix(7) {|a,b| a / b },
'%' => infix(7) {|a,b| a % b },
'div' => infix(7) {|a,b| a.div b },
'**' => infix(8) {|a,b| a ** b },
'gcd' => prefix {|x,y| x.gcd(y) },
'lcm' => prefix {|x,y| x.lcm(y) },
'sin' => prefix {|x| Math.sin(x) },
'cos' => prefix {|x| Math.cos(x) },
'tan' => prefix {|x| Math.tan(x) },
'sinh' => prefix {|x| Math.sinh(x) },
'cosh' => prefix {|x| Math.cosh(x) },
'tanh' => prefix {|x| Math.tanh(x) },
'asin' => prefix {|x| Math.asin(x) },
'acos' => prefix {|x| Math.acos(x) },
'atan' => prefix {|x| Math.atan(x) },
'asinh' => prefix {|x| Math.asinh(x) },
'atanh' => prefix {|x| Math.atanh(x) },
'sqrt' => prefix {|x| Math.sqrt(x) },
'log' => prefix {|x| Math.log(x) },
'log10' => prefix {|x| Math.log10(x) },
'log2' => prefix {|x| Math.log(x)/Math.log(2) },
'exp' => prefix {|x| Math.exp(x) },
'erf' => prefix {|x| Math.erf(x) },
'erfc' => prefix {|x| Math.erfc(x) },
'floor' => prefix {|x| x.floor },
'ceil' => prefix {|x| x.ceil },
'string' => prefix {|x| x.to_s },
'int' => prefix {|x| x.to_i },
'float' => prefix {|x| x.to_f },
'rand' => prefix {|| rand },
'conj' => prefix {|x| x.conj },
'im' => prefix {|x| x.imag },
're' => prefix {|x| x.real },
'round' => prefix {|x| x.round },
'abs' => prefix {|x| x.abs },
'minus' => prefix {|x| -x },
'plus' => prefix {|x| x },
'!' => prefix {|x| !x },
'~' => prefix {|x| ~x },
'substr' => prefix {|x,a,b| x.slice(a,b) },
'len' => prefix {|x| x.length },
'tolower' => prefix {|x| x.downcase },
'toupper' => prefix {|x| x.upcase },
'strip' => prefix {|x| x.strip },
'reverse' => prefix {|x| x.reverse },
'index' => prefix {|x,y| x.index(y) },
'rindex' => prefix {|x,y| x.rindex(y) },
'=' => '==',
'or' => '||',
'and' => '&&',
'mod' => '%',
'ln' => 'log',
'imag' => 'im',
'real' => 're',
'count' => 'len',
'size' => 'len',
'length' => 'len',
'trim' => 'strip',
'downcase' => 'tolower',
'upcase' => 'toupper',
'slice' => 'substr',
}