예제 #1
0
파일: func.py 프로젝트: nhrade/Ispy
 def call(self, call_args):
     # ls = [(arg, call_arg) for arg in self.args for call_arg in call_args]
     if  not isinstance(call_args[0], list):
         return call_args[0]
     call_val = [v for v in self.val]
     for i, v in enumerate(self.args):
         call_val = self._replacel(call_val, v, call_args[i])
     return main.eval_(call_val)
예제 #2
0
파일: lists.py 프로젝트: nhrade/Ispy
def sum_(args):
    if isinstance(args[0], list):
        return sum(m.eval_(args[0]))
예제 #3
0
파일: lists.py 프로젝트: nhrade/Ispy
def tail(args):
    return m.eval_(m.eval_(args[0])[1:])
예제 #4
0
파일: lists.py 프로젝트: nhrade/Ispy
def fst(args):
    if not isinstance(args[0], list):
        m.panic("argument not list")
    else: return m.eval_(m.eval_(args[0])[0])
예제 #5
0
파일: mathlib.py 프로젝트: nhrade/Ispy
def is_prime(args):
    for i in range(2, m.eval_(args[0])):
        if m.eval_(args[0]) % i == 0: return False
    return True
예제 #6
0
파일: mathlib.py 프로젝트: nhrade/Ispy
def odd(args):
    return m.eval_(args[0]) % 2 != 0       
예제 #7
0
파일: mathlib.py 프로젝트: nhrade/Ispy
def even(args):
    return m.eval_(args[0]) % 2 == 0
예제 #8
0
파일: mathlib.py 프로젝트: nhrade/Ispy
def abs_(args):
    return abs(m.eval_(args[0]))          
예제 #9
0
파일: mathlib.py 프로젝트: nhrade/Ispy
def sq(args):
    return m.eval_(args[0])**2  
예제 #10
0
파일: mathlib.py 프로젝트: nhrade/Ispy
def sqrt_(args):
    return math.sqrt(m.eval_(args[0]))