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