Sujet : Re: Command Languages Versus Programming Languages
De : ldo (at) *nospam* nz.invalid (Lawrence D'Oliveiro)
Groupes : comp.unix.shell comp.unix.programmer comp.lang.miscDate : 07. Aug 2024, 01:34:22
Autres entêtes
Organisation : A noiseless patient Spider
Message-ID : <v8ubtt$1u86k$1@dont-email.me>
References : 1 2 3 4 5 6 7 8 9 10 11 12 13
User-Agent : Pan/0.159 (Vovchansk; )
On Tue, 6 Aug 2024 08:04:35 -0000 (UTC), Sebastian wrote:
Better:
a = b ? (c ? d : e) :
f ? (g ? h : i) :
j;
Better still (fewer confusing parentheses):
a =
b ?
c ? d : e
: f ?
g ? h : i
: j;
Equivalent Lisp, for comparison:
(setf a (cond (b (if c d e))
(f (if g h i))
(t j)))
You can’t avoid the parentheses, but this, too, can be improved:
(setf a
(cond
(b
(if c d e)
)
(f
(if g h i)
)
(t
j
)
) ; cond
)