William Xu <[EMAIL PROTECTED]> writes: > Not in debian yet.. Guile 1.6.7 here.
Yeah, I know, unfortunately... >> guile> (define a (make-uniform-array #\nul 10)) >> guile> (uniform-array-read! a (open-input-string (string #\001 #\002 >> #\003))) >> 3 >> guile> a >> #s8(1 2 3 32 51 10 -102 96 48 10) >> guile> >> >> IOW, it seems to work fine --- except that: >> >> 1. The array is not properly initialized; > > It is. Not with Guile 1.7, see above (it should only contain zeros starting from the fourth element). > What is that "result"? See this comparison of Guile 1.6 and 1.7: $ guile-1.6 guile> (make-uniform-array #\a 10) "aaaaaaaaaa" guile> (make-uniform-array #\nul 10) #y(0 0 0 0 0 0 0 0 0 0) guile> (make-uniform-array #\001 10) "" $ guile-1.7 guile> (make-uniform-array #\a 10) "\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00" guile> (make-uniform-array #\nul 10) #s8(15 -44 -17 16 16 4 118 8 0 0) guile> (make-uniform-array #\001 10) "\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00" All the results differ. Notably, Guile 1.7 fails to properly initialize the arrays returned. However, note that Guile 1.6 already handles the `#\nul' case specially: in that case, `make-uniform-array' doesn't return a string (as explained in the manual) but an array. > guile> (uniform-array-read! a (open-input-string (string #\001 #\002 > #\003))) > > The second argument for uniform-array-read! is a string. In my codes, i > tried to read binary data, precisely, a network packet. Does this > matter? The second argument is an input port, not a string: `open-input-string' returns an input port, like `open-input-file'. Thanks, Ludovic. _______________________________________________ Guile-user mailing list Guile-user@gnu.org http://lists.gnu.org/mailman/listinfo/guile-user