Sujet : Re: Why don't people like lisp?
De : no.email (at) *nospam* nospam.invalid (Paul Rubin)
Groupes : comp.lang.lispDate : 04. Jul 2024, 20:41:52
Autres entêtes
Organisation : A noiseless patient Spider
Message-ID : <875xtl0wsf.fsf@nightsong.com>
References : 1 2 3 4 5 6 7 8 9 10 11
User-Agent : Gnus/5.13 (Gnus v5.13) Emacs/27.1 (gnu/linux)
Lawrence D'Oliveiro <
ldo@nz.invalid> writes:
In Haskell, max always takes two args of an ordered type, and maximum
takes a list arg.
Seems unnecessary to have two functions when one will do.
In Haskell that doesn't really make sense. Haskell functions actually
all take only one arg. Multi-arg functions work by currying. So
"max [1,2,3]" gives a function that compares [1,2,3] to a list you
supply. The default order relation on lists compares lexicographically.
But then, Python max and min work for things besides numbers.
Yeah I was surprised to find that in Lisp and Scheme, they only work on
numbers. Haskell has an Ord typeclass, which is like an interface for
datatypes that support comparison. max and min work for any type that
implements Ord.