Re: Why don't people like lisp?

Liste des GroupesRevenir à cl lisp 
Sujet : Re: Why don't people like lisp?
De : jbb (at) *nospam* notatt.com (Jeff Barnett)
Groupes : comp.lang.lisp
Date : 03. Jul 2024, 04:59:24
Autres entêtes
Organisation : A noiseless patient Spider
Message-ID : <v62eqe$20o3c$1@dont-email.me>
References : 1 2 3 4 5 6
User-Agent : Mozilla Thunderbird
On 7/2/2024 6:15 PM, Paul Rubin wrote:
Lawrence D'Oliveiro <ldo@nz.invalid> writes:
If a function like “max” or “min” is defined to return a number,

They are defined to return the larger or smaller of two members of any
datatype with an order relation, e.g. lexicographic order on strings.
There is no infinity for strings.  There's also none for integers, for
that matter.

then it makes sense that the maximum of an empty list should be -∞,

Meh, it's just undefined.  Otherwise you can't tell whether the list is
empty or actually contains -∞ as a value.

Consider a SUM of a set of integers: mathematicians define that operator
to return 0 for the empty set

Similarly:
MAX empty-set = -oo
MIN empty-set = +oo
PRODUCT empty-set = 1
and, in general,
GROUP OPERATOR empty-set = group-identity-element

This convention makes a whole lot of sense because, for one thing, it
makes definition of indefinite number of argument functions very easy.

For example SUM nil = 0
and SUM (CONS x list) = x + SUM list

If you try this sort of definition for MAX, the only value in all known
mathematics that can replace 0 in the above is -oo.

If you want to get into details, what I've said here applies to abelian
groups; we need to be careful about order in other settings.

and a lot of special cases no longer become special.

More likely a lot of errors go undetected.  Better to handle the special
cases in some sane way, if they can happen in the program and need
handling.

PS oo is meant to stand for numerical infinity.
--
Jeff Barnett


Date Sujet#  Auteur
28 Jun 24 * Re: Why don't people like lisp?17B. Pym
29 Jun 24 `* Re: Why don't people like lisp?16HenHanna
29 Jun 24  `* Re: Why don't people like lisp?15Jeff Barnett
30 Jun 24   +- Re: Why don't people like lisp?1HenHanna
3 Jul 24   `* Re: Why don't people like lisp?13Paul Rubin
3 Jul 24    `* Re: Why don't people like lisp?12Lawrence D'Oliveiro
3 Jul 24     `* Re: Why don't people like lisp?11Paul Rubin
3 Jul 24      +- Re: Why don't people like lisp?1Jeff Barnett
3 Jul 24      `* Re: Why don't people like lisp?9Lawrence D'Oliveiro
3 Jul 24       `* Re: Why don't people like lisp?8Paul Rubin
4 Jul 24        `* Re: Why don't people like lisp?7Lawrence D'Oliveiro
4 Jul 24         `* Re: Why don't people like lisp?6Paul Rubin
4 Jul 24          +* Re: Why don't people like lisp?3Lawrence D'Oliveiro
4 Jul 24          i+- Re: Why don't people like lisp?1Paul Rubin
4 Jul 24          i`- Re: Why don't people like lisp?1Ben Bacarisse
4 Jul 24          `* Re: Why don't people like lisp?2Jeff Barnett
4 Jul 24           `- Re: Why don't people like lisp?1Kaz Kylheku

Haut de la page

Les messages affichés proviennent d'usenet.

NewsPortal