Scheme Guile方案条件错误:要应用的类型错误
我不清楚为什么这个条件给出了错误的类型来应用错误 方案@(欺骗用户)[12]>(条件((等于?“i”i)=>(显示“yay”)) 耶 错误:在过程#中: 错误:要应用的类型错误:# scheme@(guile user)[12]>(cond((string=“i”“i”)=>(display“yay”)) 耶 错误:在过程#中:Scheme Guile方案条件错误:要应用的类型错误,scheme,guile,Scheme,Guile,我不清楚为什么这个条件给出了错误的类型来应用错误 方案@(欺骗用户)[12]>(条件((等于?“i”i)=>(显示“yay”)) 耶 错误:在过程#中: 错误:要应用的类型错误:# scheme@(guile user)[12]>(cond((string=“i”“i”)=>(display“yay”)) 耶 错误:在过程#中: 错误:要应用的类型错误:#cond的常用语法如下: (cond ((equal? "i" "i") (display "yay"))) ; prints
错误:要应用的类型错误:#cond的常用语法如下:
(cond ((equal? "i" "i")
(display "yay")))
; prints yay
当我们想要将条件的结果作为参数传递给执行的函数时,我们使用=>
,例如:
(cond ((equal? "i" "i")
=> display))
; prints #t
在上述代码中,条件的计算结果为#t
,并且#t
作为参数传递给显示
,显示将打印它