[plt-scheme] number<->bytes

From: Matthew Flatt (mflatt at cs.utah.edu)
Date: Mon Mar 28 11:35:34 EST 2005

> When converting between numbers and byte-strings, I use
> (define (number->bytes num)
>   (string->bytes/utf-8 (number->string num)))
> (define (bytes->number byt)
>   (string->number (bytes->string/utf-8 byt)))
> But will it be (a little) more efficient if MzScheme can provide the 
> two as build-ins? After all, string representation of a number can't 
> contain a non-ascii character.

I've considered this, but I didn't add `bytes->number' and
`number->bytes' because I had a difficult time thinking of an
application where the performance difference would show up.
Does anyone have an example?


Posted on the users mailing list.