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

question regarding maphash



when i execute the following

(defun mapx (f s) (mapcar f s))
(defun maph (f s) (maphash f s))
(mapx #'(lambda (a) (print a)) '(1 2 3))
 
(setf h (make-hash-table))
(setf (gethash 1 h) 'a)
(setf (gethash 2 h) 'b)
(print h)
 
(maph #'(lambda (a) (print a)) h)

i get this output

;; Loading file /home/dxs/gmgr/x.lsp ...
1 
2 
3 
#S(HASH-TABLE EQL (2 . B) (1 . A)) 
*** - EVAL/APPLY: too many arguments given to :LAMBDA
1. Break> where
 
APPLY frame for call (:LAMBDA '2 'B)

shouldnt mapx and maph work the same way in that i could pass a
lambda expression to either of them?  could someone explain what
my mistake is?
thanks,
dan stanger