(number->string 0.80) results in "4/5", which is usually not a format suitable for display. Although we can hack it with (number->string (exact->inexact 0.80)) to get 0.8, it's still not possible to pad 0s or truncate excessive fractional part of a decimal.
It would be nice to have a function similar to ~r from Racket in student languages so that numbers can be formatted easily.
(number->string 0.80)
results in"4/5"
, which is usually not a format suitable for display. Although we can hack it with(number->string (exact->inexact 0.80))
to get0.8
, it's still not possible to pad 0s or truncate excessive fractional part of a decimal.It would be nice to have a function similar to
~r
from Racket in student languages so that numbers can be formatted easily.