1

我正在尝试在 Gimp Script-Fu 脚本中设置条件语句,但似乎没有执行任何操作。

(gimp-message "before cond")
(cond
    [#t (gimp-message "I should see this")]
    [else (gimp-message "I shouldn't see this")]
)
(gimp-message "after cond")

我得到的输出如下

script-fu.exe-Warning: before cond

script-fu.exe-Warning: after cond

我在这里做错了什么?为什么我的 gimp-messages 没有出现在cond声明中?

4

1 回答 1

1

我想我的语法cond来自球拍文档,因为 TinyScheme 或更具体地说 Script-Fu 的文档并不多

我发现Gimp识别的语法基本是一样的,只是把括号[]换成圆括号()

(gimp-message "before cond")
(cond
    (#t (gimp-message "I should see this"))
    (else (gimp-message "I shouldn't see this"))
)
(gimp-message "after cond")

更换括号后,我得到了预期的输出。令人沮丧的是,没有错误地说括号是意外的。

于 2017-05-09T20:53:13.030 回答