opening it up with Common Lisp

Favorite weblogs

Lisp Related

Bill Clementson

Finding Lisp


Planet Lisp



Talking Points Memo

This Modern World

Working for Change

Other home


Recent Readings

Book review: Darwinia
Reviewed: Friday, August 11, 2006

Summer reading: Spin
Reviewed: Saturday, August 5, 2006

Reviewed: Tuesday, July 18, 2006

the Omnivoire's Delimma
Reviewed: Wednesday, July 12, 2006

the Golem's Eye
Reviewed: Wednesday, May 31, 2006


Code Clarity
Wednesday, May 19, 2004

Which is clearer?

(let ((submeetings (links meeting-tree)))
    (when submeetings 
      (dolist (submeeting submeetings)
          planner submeeting resources 
          taskforce intent organization))))

or this one?

or this one?

(dolist (submeeting (links meeting-tree))
      planner submeeting resources 
      taskforce intent organization))

The first version makes it clear that the links in a meeting-tree are submeetings and that nothing happens unless there really are some submeetings. The second relies on the reader knowing that dolist won't evaluate its body unless the list mapped over is non-nil.

For me, the second version wins by being shorter and more idiomatic. I can imagine people liking the first version because it appears more clear but I think that this clarity is deceiving and that the second version will wear better. Just a thought.


Home | About | Quotes | Recent | Archives

Copyright -- Gary Warren King, 2004 - 2006