lamb/mods/std/op.lamb
2015-03-17 00:55:20 -07:00

33 lines
583 B
Text

-- Standard operators library for the Lamb programming language
-- Copyright (c) 2013 darkf
-- Licensed under the terms of the zlib license, see LICENSE for details
-- binary operators
add(x,y) -> x+y.
mul(x,y) -> x*y.
div(x,y) -> x/y.
cons(x,y) -> x::y.
eq(x,y) -> x==y.
neq(x,y) -> x != y.
lt(x,y) -> x<y.
gt(x,y) -> x>y.
not(true) -> false.
not(false) -> true.
and(true,true) -> true.
and(_,_) -> false.
or(true, _) -> true.
or(_, true) -> true.
or(_, _) -> false.
xor(true, false) -> true.
xor(false, true) -> true.
xor(_, _) -> false.
-- unary operators
neg(x) -> 0-x.