Deutsch   English   Français   Italiano  
<v8ubtt$1u86k$1@dont-email.me>

View for Bookmarking (what is this?)
Look up another Usenet article

Path: ...!3.eu.feeder.erje.net!feeder.erje.net!eternal-september.org!feeder3.eternal-september.org!news.eternal-september.org!.POSTED!not-for-mail
From: Lawrence D'Oliveiro <ldo@nz.invalid>
Newsgroups: comp.unix.shell,comp.unix.programmer,comp.lang.misc
Subject: Re: Command Languages Versus Programming Languages
Date: Tue, 6 Aug 2024 23:34:22 -0000 (UTC)
Organization: A noiseless patient Spider
Lines: 38
Message-ID: <v8ubtt$1u86k$1@dont-email.me>
References: <uu54la$3su5b$6@dont-email.me>
	<LISP-20240402085115@ram.dialup.fu-berlin.de>
	<LISP-20240402091729@ram.dialup.fu-berlin.de>
	<wrap-20240402092558@ram.dialup.fu-berlin.de> <uui7hf$3gona$1@dont-email.me>
	<uuj1o5$3pvnq$1@dont-email.me> <87plv6jv1i.fsf@nosuchdomain.example.com>
	<wwv5xwyifq8.fsf@LkoBDZeT.terraraq.uk>
	<if-20240404121825@ram.dialup.fu-berlin.de> <uund4g$ugsb$1@dont-email.me>
	<uup8ul$1fr2t$1@dont-email.me>
	<indentation-20240405183703@ram.dialup.fu-berlin.de>
	<v8sleh$1g9s4$1@dont-email.me>
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
Injection-Date: Wed, 07 Aug 2024 01:34:22 +0200 (CEST)
Injection-Info: dont-email.me; posting-host="8e0bcc1e6c667f299b1c29714d183294";
	logging-data="2040020"; mail-complaints-to="abuse@eternal-september.org";	posting-account="U2FsdGVkX1+L1Z7UUSZXXO3EcUgFqzJi"
User-Agent: Pan/0.159 (Vovchansk; )
Cancel-Lock: sha1:mzME3bcztqmJpoLx/Wh+B0EA/34=
Bytes: 2196

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
    )