Hi,

Am 28.12.2009 um 04:59 schrieb RD:

>    (cond
>         condition1 (do exp1 exp2 exp)
>         condition2 (do exp1 exp2 ...)
>         true (do .......))
> 
> Is there a better way (without the explicit "do") to write this??

Since the results of exp1 up to expN-1 are thrown away you are doing them only 
for side effects. Try to restructure your code in a more functional fashion, so 
that you get (let [res1 exp1 res2 exp2 ...] (expN resN-1)). Then tho do will be 
gone. If the side effects are necessary (eg. I/O) the ugly do should remind you 
of this.

If the expression chain gets too long, you should refactor them in their own 
functions.

Sincerely
Meikel

-- 
You received this message because you are subscribed to the Google
Groups "Clojure" group.
To post to this group, send email to [email protected]
Note that posts from new members are moderated - please be patient with your 
first post.
To unsubscribe from this group, send email to
[email protected]
For more options, visit this group at
http://groups.google.com/group/clojure?hl=en

Reply via email to