The examples are in Scheme, which is line-noise to me, so I've been using the scm2perl translator to help me understand the examples in my native perl. It does a decent job of translation, although it doesn't understand lambda functions (anon subs). scm2perl is part of the Gimp CPAN package and handles Gimp's script-fu dialect of Scheme.
Example:
[localhost:~] thomas% less sum.scm
(define (sum term a next b)
(if (> a b)
0
(+ (term a)
(sum term (next a) next b))))
[localhost:~] thomas% scm2perl sum.scm
creating parser...done
header...reading(sum.scm)...translating...trailer...wrote(sum.pl)
[localhost:~] thomas% less sum.pl
#!/usr/bin/perl
use Gimp qw(:auto);
use Gimp::Fu;
sub sum {
my ($term, $a, $next, $b) = @_;
if ($a > $b) {
0;
} else {
(term ($a) + sum ($term, next ($a), $next, $b));
}
}
exit main;
Line noise? (Score:2)
The Little Schemer and The Seasoned Schemer are also worth a go, the stuff in 'seasoned' dealing with continuations, co routines and all that jazz is definitely deep voodoo.
ugh (Score:3, Informative)
I seriously suggest trying to wean yourself out of the translator. Grok Scheme. Then move on and grok Smalltalk. Prolog. Forth. (*) That's called "learning", I believe.
(*) No, that's not a progression of "guruness", or recommendations, just a selection of mind-expanding experiences.
Reply to This
Skeem (Score:1)