AM Posted April 30, 2017 Share Posted April 30, 2017 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)) Quote Link to comment Share on other sites More sharing options...
torstenanders Posted May 1, 2017 Share Posted May 1, 2017 (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 Quote Link to comment Share on other sites More sharing options...
AM Posted May 1, 2017 Author Share Posted May 1, 2017 THANX!!! andré Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.