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