2015-11-08 13:30:42 +01:00
|
|
|
class Integer < Value
|
2015-11-08 16:11:03 +01:00
|
|
|
int digit()
|
|
|
|
if_plus( self - 10)
|
|
|
|
return 32
|
|
|
|
else
|
|
|
|
Word numbers = "0123456789"
|
|
|
|
return numbers.at(self)
|
2015-11-08 13:30:42 +01:00
|
|
|
end
|
|
|
|
end
|
2015-11-08 16:11:03 +01:00
|
|
|
|
|
|
|
Word as_string(Word str)
|
|
|
|
if_plus( self - 10 )
|
|
|
|
int num = digit()
|
|
|
|
str = str.add_digit( num )
|
|
|
|
return str
|
2015-11-08 13:30:42 +01:00
|
|
|
end
|
2015-11-08 16:11:03 +01:00
|
|
|
int rest = self / 10
|
|
|
|
str = rest.as_string( str )
|
2015-11-08 13:30:42 +01:00
|
|
|
return str
|
|
|
|
end
|
2015-11-08 16:11:03 +01:00
|
|
|
|
|
|
|
Word to_s()
|
2015-11-08 13:30:42 +01:00
|
|
|
Word start = " "
|
2015-11-08 16:11:03 +01:00
|
|
|
return as_string( start )
|
2015-11-08 13:30:42 +01:00
|
|
|
end
|
|
|
|
end
|