[plt-scheme] number<->bytes

From: Zhu Chongkai (mathematica at citiz.net)
Date: Sun Mar 27 21:51:05 EST 2005

Hi all,

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.

Best regards, 
Zhu Chongkai
http://www.neilvandyke.org/mrmathematica/



Posted on the users mailing list.