User:Ramcinfo/fancu staile
Let us think about selbri as function taking its terbri as arguments and returning the predication, or bridi. This predication can be then claimed in context, returning truth-value of resulting bridi in that context.
function tavla(speaker, listener, subject, language) {...} // returns predication function claim(predication, context) {...} // returns boolean claim(tavla("me", "you", "lojban", "lojban"), context);
To build functions returning other things, we can use {lo}. Let us not go into intricacies of descriptors and pretend what {lo selbri} returns simply some value s1 such that claim(selbri(s1, s2...sx), context) will be true for some values of s2...sx and some context.
{loka}- and {me'ei}-abstractions, then, are predication-returning functions as first-class values. {me'au} with these abstractions is function application; {kai'u} is immediate function application.
We also need function with return types other than predication. {be...bei...be'o} allows for partial application of arguments to selbri, returning another selbri with some of arguments replaced by constants. So {lo selbri be sumti2 bei sumti3 be'o} is x1 = selbri1(sumti2, sumti3).
We are now ready to construct function taking a function as argument and returning other function. Let's start with apply:
lo ka return buboi fun buboi arg buboi ce'ai return buboi me'au fun buboi arg buboi kei goi apli buboi
function apply(fun, arg) { return fun(arg);}
Now we can use it as such:
lo me'au apli buboi be me'ei tavla bei mi be'o