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
-- "A screaming comes across the sky. It has happened before, but there is nothing to compare to it now."