[racket] number->string in the HtDP student languages

From: Breanndán Ó Nualláin (bon at science.uva.nl)
Date: Wed Feb 18 03:17:19 EST 2015

In BSL, I just got caught out by this behaviour:

  > (number->string 0.75)
  "3/4"

I expected the same behaviour as in the full Racket language:

  > (number->string 0.75)
  "0.75"

What's the thinking behind this? Wouldn't the decimal notation be more intuitive, particularly in cases like this?

  > (number->string 0.7555555)
  "1511111/2000000"

And especially in cases like this?

  > (number->string (string->number (number->string pi)))
  "3141592653589793/1000000000000000"

Posted on the users mailing list.