see if any branch of a cond succeeded

2011-11-05 Thread Martin DeMello
What's the cleanest way to run a piece of code if any branch of a cond statement succeeded, without relying on the return value of the individual clauses not to be nil? For example, if I have the following piece of code that says I can only move left or up (cond (= dir :left) (move-left) (=

Re: see if any branch of a cond succeeded

2011-11-05 Thread Baishampayan Ghose
On Sat, Nov 5, 2011 at 11:55 AM, Martin DeMello martindeme...@gmail.com wrote: What's the cleanest way to run a piece of code if any branch of a cond statement succeeded, without relying on the return value of the individual clauses not to be nil? For example, if I have the following piece of

Re: see if any branch of a cond succeeded

2011-11-05 Thread Alan Malloy
On Nov 4, 11:49 pm, Baishampayan Ghose b.gh...@gmail.com wrote: On Sat, Nov 5, 2011 at 11:55 AM, Martin DeMello martindeme...@gmail.com wrote: What's the cleanest way to run a piece of code if any branch of a cond statement succeeded, without relying on the return value of the individual

Re: see if any branch of a cond succeeded

2011-11-05 Thread Dennis Haupt
-BEGIN PGP SIGNED MESSAGE- Hash: SHA1 what about (cond (= dir :left) ((move-left)(:ok)) (= dir :up) ((move-up)(:ok)) :else :nok) or whatever the exact syntax is Am 05.11.2011 08:22, schrieb Alan Malloy: On Nov 4, 11:49 pm, Baishampayan Ghose b.gh...@gmail.com wrote: On Sat, Nov 5,

Re: see if any branch of a cond succeeded

2011-11-05 Thread Alan Malloy
Assuming that you meant (do (move-left) (:ok)), this is insufficient except in the rare case where he doesn't care about the return value of move-left. On Nov 5, 2:18 am, Dennis Haupt d.haup...@googlemail.com wrote: -BEGIN PGP SIGNED MESSAGE- Hash: SHA1 what about (cond (= dir