Naming, compare function return values Panu A Kalliokoski (05 May 2005 16:16 UTC)
Re: Naming, compare function return values Jens Axel Søgaard (05 May 2005 17:37 UTC)
Re: Naming, compare function return values Panu Kalliokoski (08 May 2005 19:25 UTC)
Re: Naming, compare function return values Jens Axel Søgaard (08 May 2005 20:25 UTC)
Re: Naming, compare function return values Michael Sperber (16 May 2005 19:06 UTC)

Re: Naming, compare function return values Jens Axel Søgaard 05 May 2005 17:37 UTC

Panu A Kalliokoski wrote:

> (2) the codomain of compare functions is {-1, 0, 1} which reminds me of
> other (bad) programming languages where real enumerations are hard to
> do.  While these values bear some intuitive semblance to orderings
> (because of the sign function), the traditional Lisp/Prolog/ML way for
> things like this are real descriptive values, in the case of Scheme, the
> symbols {less, equal, greater} (or {lt, eq, gt}).  The only reason to
> use the nondescriptive values is AFAIU the possibility to add and
> multiply values produced from compare functions, which easily leads to
> ugly code.  So, is there some kind of rationale for the codomain of
> compare functions?

See the section "How to represent the three cases?" in the
Design Rationale:

     <http://srfi.schemers.org/srfi-67/srfi-67.html#node_sec_6>

--
Jens Axel Søgaard