[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: question regarding maphash



Dan Stanger wrote:
> (defun maph (f s) (maphash f s))
> (setf h (make-hash-table))
> (setf (gethash 1 h) 'a)
> (setf (gethash 2 h) 'b)
> (print h)
>  
> (maph #'(lambda (a) (print a)) h)
> *** - EVAL/APPLY: too many arguments given to :LAMBDA

Maphash uses a function with two arguments, the first being the hash
key, the second the value. Your lambda only has one parameter.

(maph #'(lambda (k v) (format t "~&~S ~S~%" k v)) h) should work.

	Joerg Hoehle
hoehle@inf-wiss.uni-konstanz.de