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")
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)))
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)))
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))
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)))
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)))
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))
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))
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))