Category:Fexl: Difference between revisions

Content added Content deleted
No edit summary
No edit summary
Line 7: Line 7:


Ultimately the core functions of Fexl are written in the [[C]] programming language. To write a new core function named "X" within Fexl, you simply create an appropriate C routine named "fexl_X". It automatically becomes available as a built-in Fexl function.
Ultimately the core functions of Fexl are written in the [[C]] programming language. To write a new core function named "X" within Fexl, you simply create an appropriate C routine named "fexl_X". It automatically becomes available as a built-in Fexl function.

For example, here is the C routine which implements the classic '''S''' combinator (fusion), where (S x y z) = (x z) (y z):

<lang C>
value fexl_S(value f)
{
if (!f->L->L || !f->L->L->L) return f;
return A( A(f->L->L->R, f->R), A(f->L->R, f->R) );
}
</lang>