Why does (write-u8 49 current-output-port)
fail with an error when I evaluate it in an REPL?
chibi-scheme 0.10.0:
> (write-u8 49 current-output-port)
ERROR in "write-u8": invalid type, expected Output-Port: #<opcode "current-output-port">
Guile 3.0.8:
scheme@(guile-user)> (import (scheme base))
scheme@(guile-user)> (write-u8 49 current-output-port)
ice-9/boot-9.scm:1685:16: In procedure raise-exception:
In procedure put-u8: Wrong type argument in position 1 (expecting open output port): #<<parameter> 7f38972eb9c0 proc: #<procedure 7f38972f4200 at ice-9/boot-9.scm:1361:3 () | (x)>>
MIT Scheme 11.2:
1 ]=> (write-u8 49 current-output-port)
;The object #[compiled-closure 12 ("dynamic" #xd) #x17c #x27f522c ...], passed as an argument to #[compiled-procedure 13 ("binary-port" #x3) #x1c #x291d984], is not the correct type
current-output-port
is a procedure. You have to call it and use its return value as an argument to write-u8
.
(write-u8 49 (current-output-port))