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

Style Question: mapcar vs. dolist



Hello all,

Thanks so much for answering my previous questions.  I have been using MCL
for about a week now and I love it!  I plan to use it for all of my proto-
typing needs.

Well, here's my question.  In performing operations on list, I got into
the habit of doing things like

(mapcar #'(lambda (object) (some action on object)) list-of-objects)


Today, however, I discovered DOLIST.  Presumably, I could do this instead:

(dolist (object list-of-objects) (some action on object))


So my questions are:
 1.  Are the above two forms always equivalent?
 2.  If so, when is it more stylistic to use DOLIST?  To use MAPCAR?


Thanks for your input!
Cecil Huang
cecil@camis.stanford.edu