def func(self, scope, args): args = args[0] for i in xrange(len(args)): n = args[i] if not types.is_number(n): raise LispException("argument %d of %s must be number, was %s" % (i + 1, func.__name__, types.type_name(n))) return types.py_to_type(m.reduce_num(reducer, *(n.value for n in args)))
def is_fraction(self, scope, args): return types.py_to_type(types.is_number(args[0]) and isinstance(args[0].value, Fraction))
def is_int(self, scope, args): return types.py_to_type(types.is_number(args[0]) and isinstance(args[0].value, long))
def is_decimal(self, scope, args): return types.py_to_type(types.is_number(args[0]) and isinstance(args[0].value, Decimal))
def is_number(self, scope, args): return types.py_to_type(types.is_number(args[0]))