rubyx/lib/soml/parfait/integer.soml
2015-11-08 17:11:03 +02:00

27 lines
452 B
Plaintext

class Integer < Value
int digit()
if_plus( self - 10)
return 32
else
Word numbers = "0123456789"
return numbers.at(self)
end
end
Word as_string(Word str)
if_plus( self - 10 )
int num = digit()
str = str.add_digit( num )
return str
end
int rest = self / 10
str = rest.as_string( str )
return str
end
Word to_s()
Word start = " "
return as_string( start )
end
end