[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Naming, compare function return values



Two things in this SRFI strike me as particularly "un-scheme-like" (for
my conception of scheme-like, with which you may agree):

(1) the names of compare functions are of the form compare-* rather than
*-compare.  The traditional Scheme way is to prefix with type, isn't it?
Why was this naming scheme adopted?

(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?

Panu Kalliokoski

-- 
personal contact: atehwa@xxxxxx, +35841 5323835, +3589 85619369
work contact: pkalliok@xxxxxxxxxxxxxxxx, +35850 3678003
kotisivu (henkkoht):	http://www.iki.fi/atehwa/
homepage (technical):	http://sange.fi/~atehwa/