[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [Chicken-users] foreign-lambda* problems on Mac OS X
From: |
Thomas Chust |
Subject: |
Re: [Chicken-users] foreign-lambda* problems on Mac OS X |
Date: |
Wed, 13 Jul 2005 14:19:16 +0200 |
User-agent: |
Mozilla Thunderbird 1.0.2 (Macintosh/20050317) |
Raffael Cavallaro wrote:
[...]
In the code in question, tak is the scheme name of a foreign-lambda*
that calls itself recursively - that is, the takeuchi function call
benchmark.
I think that this is a recursion issue, since the basic my-strlen
example that Thomas Chust was kind enough to send works fine.
[...]
#>! ... <# already embeds ... verbatim *and* parses it to generate
Scheme bindings, so you should simply do it this way:
imurph:~/Unsorted murphy$ cat >tak-fp-c.scm
#>!
float tak(float x, float y, float z) {
if (y >= x) {
return (z);
}
else {
return (tak(tak(x-1,y,z), tak(y-1,z,x), tak(z-1,x,y)));
}
}
<#
imurph:~/Unsorted murphy$ csc -O2 -s tak-fp-c.scm
imurph:~/Unsorted murphy$ csi -quiet
#;1> (use tak-fp-c)
#;2> (tak 3 2 1)
2.0
#;3> ,q
I would suggest you to reread the CHICKEN manual section on the foreign
function interface -- it is a very powerful feature but not easy to
understand thoroughly at first glance (at least not for me :)
cu,
Thomas Chust