On 11-May-09, at 11:51 PM, Brendan MacDonell wrote:
On Mon, 11 May 2009, Marc Feeley wrote:
The procedure call-with-output-u8vector returns the u8vector that was accumulated.
This seems oddly inconsistent with call-with-input-vect and with-input-from-vect, both of which return the results of the execution. In fact, the manual and wiki both list the output variants as returning the values of their procedure or thunk, respectively, so it might be necessary to update the documentation.
Brendan MacDonell
Just to be clear... the documentation is incorrect. The behavior of call-with-output-string is consistent with many other Scheme implementations that have this extension (see below for a few). If I remember correctly, Gambit inherited this behavior from MIT-Scheme some 20 years ago!
Marc
MIT/GNU Scheme 7.7.90.+: 1 ]=> (call-with-output-string (lambda (p) (write (cons 1 2) p) 123)) ;Value 11: "(1 . 2)"
Chicken 3.4.0: #;1> (call-with-output-string (lambda (p) (write (cons 1 2) p) 123)) "(1 . 2)"
STklos 0.82: stklos> (call-with-output-string (lambda (p) (write (cons 1 2) p) 123)) "(1 . 2)"
Gauche 0.8.13: gosh> (call-with-output-string (lambda (p) (write (cons 1 2) p) 123)) "(1 . 2)"
scsh 0.6.7:
(call-with-string-output-port (lambda (p) (write (cons 1 2) p) 123))
"(1 . 2)"
Bigloo 3.1b: 1:=> (string-append "foo:" (with-output-to-string (lambda () (write (cons 1 2)) 123))) foo:(1 . 2)