当我在REPL中计算错误时,为什么(write-u8 49 current-output-port)会失败呢?
chibi-方案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)>>麻省理工学院计划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发布于 2022-05-28 18:19:54
current-output-port是一种程序。您必须调用它并使用它的返回值作为write-u8的参数。
(write-u8 49 (current-output-port))https://stackoverflow.com/questions/72417304
复制相似问题