Search code examples
gimpscript-fu

Gimp Script-Fu cond none of the conditions execute


I am trying to set up a conditional statement in a Gimp Script-Fu script, and nothing appears to be executing.

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

The output I'm getting is the following

script-fu.exe-Warning: before cond

script-fu.exe-Warning: after cond

What am I doing wrong here? Why are none of my gimp-messages showing up in the cond statement?


Solution

  • I think I got my syntax for cond from racket documentation since there isn't a lot of documentation for TinyScheme or more specifically Script-Fu

    I found that the syntax recognized by Gimp is basically the same thing, but replacing the brackets [] with parentheses ()

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

    After replacing the brackets I got my expected output. It's frustrating that there was no error to say that the brackets were unexpected.