April 30, 20178 yr is it possible to do such a (nonsense-function) with mapcar (then with loop)? -> how should i handle the &key (y 1) with mapcar? possible? a function without &key is clear but with &key ....??? thanx for a note (defun testfu (value &key (y 1)) (* (random 10) value y)) (loop for i in '(1 2 3 4 5) for j in '(1 2 3 4 5) collect (testfu i :y j))
May 1, 20178 yr (defun testfu (value &optional (y 1)) (* (random 10) value y)) (mapcar #'testfu '(1 2 3 4 5) '(1 2 3 4 5)) I am not aware how you could handle a keyword directly by map car, but you can always turn the keyword argument into a plain argument in an intermediate function. (defun testfu (value &key (y 1)) (* (random 10) value y)) (mapcar #'(lambda (x y) (testfu x :y y)) '(1 2 3 4 5) '(1 2 3 4 5)) Best, Torsten
Create an account or sign in to comment