Bob,
I might be wrong, but I think your question is related to passing one or two lists to
mapcar.
When one list is passed, the argument function is applied to that list. When two
lists are passed, the argument function is applied each item in each list in turn.
So this (mapcar '+ '(2 3 4) '(6 7 8)) = '(8 10 12) makes sense.
It says add 2 to 6, add 3 to 7, and add 4 to 8.
Joe Burke
"tcebob" wrote in message
news:5682006@discussion.autodesk.com...
Help says mapcar applies a function to each element in a list, resulting in a list:
(mapcar '1+ '(1 2 3)) = '(2 3 4)
or (mapcar (lambda (n) (+ n 2)) '(1 2 3)) = '(4 5 6)
Well and good. But here's another use (which I'm sure everyone here but me already
knows):
(mapcar '+ '(2 3 4) '(6 7 8)) = '(8 10 12)
Well, durn. I can't see this in "Help." But is is Very important. Can you explain
the
logical leap between {1} and {2}? Did everybody but me notice this right away?
For fun I worked out a distance function (ok, I know there is one in the box):
(defun #dst2(L1 L2 / )
(expt(apply '+ (mapcar '* (mapcar '+ L1 L2)(mapcar '+ L1 L2))) 0.5)
) ;defun
Thanks for listening. I feel much better now.
rs