예제 #1
0
파일: math.py 프로젝트: 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)))
예제 #2
0
파일: math.py 프로젝트: bodil/lolisp
def greater_than_or_equal(self, scope, args):
  return types.py_to_type(args[0].value >= args[1].value)
예제 #3
0
파일: math.py 프로젝트: bodil/lolisp
def less_than_or_equal(self, scope, args):
  return types.py_to_type(args[0].value <= args[1].value)
예제 #4
0
파일: math.py 프로젝트: bodil/lolisp
def greater_than(self, scope, args):
  return types.py_to_type(args[0].value > args[1].value)
예제 #5
0
파일: math.py 프로젝트: bodil/lolisp
def is_fraction(self, scope, args):
  return types.py_to_type(types.is_number(args[0]) and isinstance(args[0].value, Fraction))
예제 #6
0
파일: math.py 프로젝트: bodil/lolisp
def less_than(self, scope, args):
  return types.py_to_type(args[0].value < args[1].value)
예제 #7
0
파일: math.py 프로젝트: bodil/lolisp
def is_decimal(self, scope, args):
  return types.py_to_type(types.is_number(args[0]) and isinstance(args[0].value, Decimal))
예제 #8
0
파일: math.py 프로젝트: bodil/lolisp
def is_int(self, scope, args):
  return types.py_to_type(types.is_number(args[0]) and isinstance(args[0].value, long))
예제 #9
0
파일: math.py 프로젝트: bodil/lolisp
def is_number(self, scope, args):
  return types.py_to_type(types.is_number(args[0]))
예제 #10
0
파일: __init__.py 프로젝트: bodil/lolisp
 def equals(self, scope, args):
   return types.py_to_type(args[0] == args[1])
예제 #11
0
파일: __init__.py 프로젝트: bodil/lolisp
 def atomic(self, scope, args):
   return types.py_to_type(types.is_atomic(args[0]))