[Top][All Lists]

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

RE: `when' vs. `and' / `unless' vs `or'

From: Drew Adams
Subject: RE: `when' vs. `and' / `unless' vs `or'
Date: Tue, 16 Oct 2018 15:13:16 -0700 (PDT)

Do whatever you like. ;-) Different people use different styles.
There is no standard or even a convention. Common Lisp
suggests some conventions, but there too there is nothing

I use `when' and `unless' when I want to show a human
reader (mainly me) that the code doesn't use or care about
the return value. I don't use them when the returned `nil'
could be important.

I use `and' or `or' when the return value is significant.
(With `not' as needed.)

I use `if' when the true part is a single sexp. If necessary,
to respect this I flip the true and false parts (negating the

I use `cond' when I have two or more sexps for each of
the true and false parts or I have more than two conditions.

I use `case' when the conditions would just test the
same symbol for equality against different values.

I don't use `pcase' much. Nothing against it, really.

Yes, the way I use `if' etc. can mean that I change which
form I use as the code evolves. I'd rather spend more
time fiddling with the code, in order to have the result
be easier to understand (for a human).


reply via email to

[Prev in Thread] Current Thread [Next in Thread]