GSOC | Extending Common Lisp support

Charles Turner chturne@gmail.com
Sat Jun 2 00:55:00 GMT 2012


On 1 June 2012 00:02, Per Bothner <per@bothner.com> wrote:
> Note that funcall is a function, not a macro.  It should be easy enough to
> implement as a short Java method or a CommonList function that
> invokes Procedure#applyN.

I implemented this using the APPLY function in primitives.lisp:

(defun apply (func &rest (args :: <Object[]>))
  (invoke (the <function>
	       (if (symbolp func) (symbol-function func) func))
	  'applyN
	  (invoke-static <gnu.kawa.functions.Apply>
				  'getArguments
				  args
				  0 #'apply)))

(defun funcall (func &rest args)
  (apply func args))

Passes the examples given in the hyperspec at least.

> where %flet is implemented using kawa.standard.let,
> except you need to do:
>  decl.setProcedureDecl(true);

I'd be inclined to do a dispatch on the syntax name, so in the
protected method something like:

if (this.getName().equals("flet")) then decl.setProcedureDecl()

but that's quite awkward with the static instances being used in these
syntax objects. What's the motivation for the static instances in
these syntax objects? I added constructors which set the syntax name
per object, and it seems to work OK, though I haven't tested whether
my FLET satisfies the semantics of the standard yet, but the method of
implementing it seems to work.

Thanks,
Charles.



More information about the Kawa mailing list