On Jul 13, 2005, at Wed, Jul 13, 8:19 16 AM, Thomas Chust wrote:

#>! ... <# 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)));

  }

}

<#


Thanks for pointing this out - It certainly makes things much easier for me.

I must look pretty obtuse - I didn't realize it could be used this way. All the C examples in the manual are for #includes and function declarations/prototypes but never function bodies, and the manual warns that the foreign parser can only deal with a limited subset of C.  So I thought that foreign-lambda* was needed for the actual inline C function bodies. Clearly as you point out it is not, which is really nice.

I'm more impressed with Chicken every day. Thanks again for your help.

regards,

Ralph

Raffael Cavallaro, Ph.D.

_______________________________________________
Chicken-users mailing list
[email protected]
http://lists.nongnu.org/mailman/listinfo/chicken-users

Reply via email to