Пример #1
0
def notequalto(interpreter, args):
    if len(args) != 2: raise Exception("NUM_ARGS")
    return [Literal(args[0].value != args[1].value)]
Пример #2
0
def negate(interpreter, args):
    if len(args) != 1: raise Exception("NUM_ARGS")
    return [Literal(-args[0].value)]
Пример #3
0
def lessthan(interpreter, args):
    if len(args) != 2: raise Exception("NUM_ARGS")
    return [Literal(args[0].value < args[1].value)]
Пример #4
0
def modulus(interpreter, args):
    if len(args) != 2: raise Exception("NUM_ARGS")
    return [Literal(args[0].value % args[1].value)]
Пример #5
0
def greaterthanequalto(interpreter, args):
    if len(args) != 2: raise Exception("NUM_ARGS")
    return [Literal(args[0].value >= args[1].value)]
Пример #6
0
def multiply(interpreter, args):
    if len(args) != 2: raise Exception("NUM_ARGS")
    return [Literal(args[0].value * args[1].value)]
Пример #7
0
def divide(interpreter, args):
    if len(args) != 2: raise Exception("NUM_ARGS")
    return [Literal(args[0].value / args[1].value)]
Пример #8
0
def subtract(interpreter, args):
    if len(args) != 2: raise Exception("NUM_ARGS")
    return [Literal(args[0].value - args[1].value)]
Пример #9
0
def ceil(interpreter, args):
    if len(args) != 1: raise Exception("NUM_ARGS")
    return Literal(math.ceil(args[0].value))
Пример #10
0
def _random(interpreter, args):
    return Literal(random.random())
Пример #11
0
def _not(interpreter, args):
    if len(args) != 1: raise Exception("NUM_ARGS")
    return [Literal(not args[0].value)]
Пример #12
0
def _and(interpreter, args):
    if len(args) != 2: raise Exception("NUM_ARGS")
    return [Literal(args[0].value and args[1].value)]