Disclaimer: I have never done any work with script-fu, so I have no idea what those script-fu specific procedures do. Scheme, however, I can do.
Please look closely at the syntax required for the let
special form:
(let <List of forms that assign values>
<body>)
I think your main problem comes from the fact that in scheme you are allowed to change the value of almost anything -- there are very few reserved words like other languages. So, when you say (let ((display 3)) <body>)
, display
no longer points to the procedure that displays things to the REPL. Then, in the body of your let*
when you say (display " onlyvisible")
you're trying to call something as a function that is not a function -- in this case whatever the value of layers
is.
In general, all code that needs to do something like display
should be in body of the function. For example:
(let ((foo 3) ; associate symbol foo with the value 3
(bar "I'm a string!") ; associate symbol bar with a string
(* '(a b c))) ; associate symbol * with a list '(a b c)
(display foo) ;\
(newline) ; \
(display bar)) ; }-- expressions that make up the body
(newline) ; /
(display *) ; /
(* 3 4)) ;/ --- this is the same type of error you made
;;Output
3
I'm a string!
(a b c)
ERROR -- invalid function
Finally, please do not format scheme code as you would C or Java, etc. Here is the schemer-friendly version of your first procedure:
(define (pitibalrog-test img filename onlyvisible)
(let ((img copy (car (gimp-image-duplicate img))))
(display " onlyvisible: ")
(display onlyvisible)
(newline)
(pitibalrog-export-layers imgcopy (gimp-image-get-layers imgcopy) filename onlyvisible)))
Well formatted code makes schemers happy and you are more likely to receive speedy help.