In the example Lisp code that I have posted, functions are defined in terms of either other defined functions or “built-in” functions which are written in the underlying implementation language – ActionScript for Flash and C# for WPF.
Built-in functions are quite easy to implement. For example, in the recent “Accordion” demo, there is a function “prim-accordion-new” which generates an instance of the Flash “Accordion” container. Here is how it is defined in ActionScript:
private static function z_initializeBuiltinPrimAccordionNew_z():void {
z_makeGlobalBuiltin_z("prim-accordion-new",
function(args:VOop, context:Context, process:Process):VOop {
return z_asVOop_z(new Accordion());
});
}
For each "primitive" Lisp function, there is a corresponding ActionScript function - the technique is similar for the .Net platform, with "function" being replaced by "delegate" and, of course, the appropriate syntax adjustments.
There is no fixed rule as to what constitutes a “primitive” function. Basically, primitives run faster than interpreted code but have less flexibility at runtime. It is a matter of judgement.
In March, there will be an SDK for the Flash implementation to allow developers to add custom primitives to the language.