[armedbear-devel] lambda-list error at compilation

Alessio Stalla alessiostalla at gmail.com
Tue May 11 13:50:41 UTC 2010

On Tue, May 11, 2010 at 3:34 PM, Mark Evenson <evenson at panix.com> wrote:
> On May 7, 2010, at 6:53 PM, Alan Ruttenberg wrote:
>> The following works as expected when evaluated, but throws an error when compiling.
>> (defun hashmap-to-hashtable (hashmap &key (keyfun #'identity) (valfun #'identity) (invert? nil)
>>                              &allow-other-keys &rest rest)
>>  (let ((keyset (#"keySet" hashmap))
>>       (table (apply 'make-hash-table (remf :invert? (remf :valfun (remf :keyfun rest))))))
>>    (with-constant-signature ((iterator "iterator" t) (hasnext "hasNext") (next "next"))
>>      (loop with iterator = (iterator keyset)
>>        while (hasNext iterator)
>>        for item = (next iterator)
>>        do (if invert?
>>               (setf (gethash (funcall valfun (#"get" hashmap item)) table) (funcall keyfun item))
>>               (setf (gethash (funcall keyfun item) table) (funcall valfun (#"get" hashmap item)))))
>>    table)))
>> -> Error
>> &REST/&BODY must be followed by a variable.
>>   [Condition of type PROGRAM-ERROR]
> Confirmed with a simplified error form not using JSS filed as [ticket
> #96][1].
> [1]: http://trac.common-lisp.net/armedbear/ticket/96

The error message is misleading, but that lambda list is wrong - &rest
must come before &key when both are present.

More information about the armedbear-devel mailing list