Re: scheme changes

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Jim Sabatke wrote:
> I understand 
> that gimp has migrated to tiny scheme and variables need to be declared 
> with let or let*.  I have tried and tried to modify some of the scripts 
> and can't get them to work.
[snip]
> The documents on the let and let* functions make it seem like I 
> shouldn't be having this much trouble.

I realize that Scheme code looks rather cryptic to a lot of people but, no, 
you shouldn't be having that much trouble.

What doesn't help matters is that a lot of Scheme code is poorly formatted 
making it look like something suitable for submission to an Obufuscated Scheme 
contest. When the code is properly formatted it is much easier to see the 
syntax of the lanuage. This also makes it easier to modify Scheme code and 
eliminates so much of the time one otherwise spends counting brackets.

As someone else mentioned, you can "cheat" and just change the 'set!' calls to 
'define'. However, putting the undefined variables in a let/let* block is 
preferred.

A let block looks like the following:
(let* (
       (var1 value-or-code-to-give-initial-value-for-variable)
       (var2 some-other-value)
       )
       ... scheme code ...
)

If your script gives you an error message along the line of 'unbound variable: 
bad-var', you just need to add 'bad-var' to the let block.

(let* (
       (var1 value-or-code-to-give-initial-value-for-variable)
       (var2 some-other-value)
       (bad-var)
       )
       ... scheme code ...
)

You don't have to even have to specify a value if you don't want to. 
Alternatively, you could take the entire Scheme set! statement where bad-var 
is first used and put it in the header without the leading set! command where 
I showed '(bad-var)'.

--
Cheers!

Kevin.

http://www.ve3syb.ca/           |"What are we going to do today, Borg?"
Owner of Elecraft K2 #2172      |"Same thing we always do, Pinkutus:
                                 |  Try to assimilate the world!"
#include <disclaimer/favourite> |              -Pinkutus & the Borg
_______________________________________________
Gimp-developer mailing list
Gimp-developer@xxxxxxxxxxxxxxxxxxxxxx
https://lists.XCF.Berkeley.EDU/mailman/listinfo/gimp-developer

[Index of Archives]     [Video For Linux]     [Photo]     [Yosemite News]     [gtk]     [GIMP for Windows]     [KDE]     [GEGL]     [Gimp's Home]     [Gimp on GUI]     [Gimp on Windows]     [Steve's Art]

  Powered by Linux