[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Scheme-reports] decoding strings from bytevectors



-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

Hi,

I recently ran into this minor issue writing some R6RS code and would
like to know how R7RS addresses it.

Say you want to extract a string from a bytevector, but the bytevector
contains other information before and after the bytes that encode the
string data. In R6RS, AFAIK, you have to copy those bytes to a new
bytevector and then decode that entire bytevector to a string
(probably causing another copy operation). I think it would be useful
if something like


(define (string-decoder bytevector position length transcoder
  (bytevector->string
   (let ((bv (make-bytevector length)))
     (bytevector-copy!
      bytevector position bv 0 length)
     bv)
   transcoder) )


were supported directly by bytevector->string without the additional
bytevector-copy.

Marijn
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v2.0.19 (GNU/Linux)
Comment: Using GnuPG with Mozilla - http://enigmail.mozdev.org/

iEYEARECAAYFAk//024ACgkQp/VmCx0OL2wcagCaA8ZkxkpYtLlFanjcs8LI6E+1
5YAAn3Qo+IONDCkQNV3eIchyaBCsAGyS
=7fcQ
-----END PGP SIGNATURE-----

_______________________________________________
Scheme-reports mailing list
Scheme-reports@x
http://lists.scheme-reports.org/cgi-bin/mailman/listinfo/scheme-reports