Пример #1
0
    def equ_numstr(self):
        """( y x -- y=x? )
        push 1 if a number is equal to the sum of the characters in a string"""
        y, x = self.popn()
        if allof(isstr(y), isnum(x)):
            self.push(CatClutter.bool2int(x == CatClutter.strsum(y)))

        elif allof(isnum(y), isstr(x)):
            self.push(CatClutter.bool2int(y == CatClutter.strsum(x)))

        else:
            CatLogger.Crit("unexpected types for equ_numstr")
Пример #2
0
 def lss_list(self):
     """( y x -- y<x? )
     push 1 if the length of list y is less than the length of list x"""
     y, x = self.popn()
     self.push(CatClutter.bool2int(len(y) < len(x)))
Пример #3
0
 def lss_str(self):
     """( y x -- y<x? )
     push 1 if the sum of the characters in y is less than that of x"""
     y, x = self.popn()
     self.push(CatClutter.bool2int(CatClutter.strsum(y) < CatClutter.strsum(x)))
Пример #4
0
 def lss_num(self):
     """( y x -- y<x? )
     push 1 if y is less than x, else push 0"""
     y, x = self.popn()
     self.push(CatClutter.bool2int(y > x))
Пример #5
0
 def gtr_list(self):
     """( y x -- y>x? )
     push 1 if the length of list y is greater than the length of list x"""
     y, x = self.popn()
     self.push(CatClutter.bool2int(len(y) > len(x)))
Пример #6
0
 def gtr_str(self):
     """( y x -- y>x? )
     push 1 if the sum of the characters in y is greater than that of x"""
     y, x = self.popn()
     self.push(CatClutter.bool2int(CatClutter.strsum(y) > CatClutter.strsum(x)))
Пример #7
0
 def gtr_num(self):
     """( y x -- y>x? )
     push 1 if y is greater than x, else push 0"""
     y, x = self.popn()
     self.push(CatClutter.bool2int(y > x))
Пример #8
0
 def equ_list(self):
     """( y x -- y=x? )
     push 1 if two lists hold the same content in the same order, else push 0"""
     y, x = self.popn()
     self.push(CatClutter.bool2int(x == y))
Пример #9
0
 def equ_str(self):
     """( y x -- y=x? )
     push 1 if two strings are of equal value, else 0"""
     y, x = self.popn()
     self.push(CatClutter.bool2int(y == x))