Example #1
0
File: math.py Project: bodil/lolisp
 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)))
Example #2
0
File: math.py Project: bodil/lolisp
def is_fraction(self, scope, args):
  return types.py_to_type(types.is_number(args[0]) and isinstance(args[0].value, Fraction))
Example #3
0
File: math.py Project: bodil/lolisp
def is_int(self, scope, args):
  return types.py_to_type(types.is_number(args[0]) and isinstance(args[0].value, long))
Example #4
0
File: math.py Project: bodil/lolisp
def is_decimal(self, scope, args):
  return types.py_to_type(types.is_number(args[0]) and isinstance(args[0].value, Decimal))
Example #5
0
File: math.py Project: bodil/lolisp
def is_number(self, scope, args):
  return types.py_to_type(types.is_number(args[0]))