Subject: Re: macros vs HOFs (was: O'Caml)
From: Erik Naggum <erik@naggum.no>
Date: 12 Sep 2002 19:29:14 +0000
Newsgroups: comp.lang.lisp
Message-ID: <3240847754703746@naggum.no>
* Alexander Schmolck
| As an aside: although what I know about CL's way of dealing with numbers seems
| rather sensible to me (promoting to a more general type iff necessary), many
| people are apparently uneasy about the idea that the result type can depend on
| the parameter values (rather than type).
What do you mean, the type depends on the parameters? The result type of a
division of integers is a rational number. Now, remember your mathematics:
an integer is a rational number. Only if you think an object is of only one
type could you become confused about this. The beauty of the Common Lisp
numeric tower is that numbers satisfy several type predicates.
| I'd be interested to hear from the experience of lisp users whether lisp's
| way of promoting numbers actually causes problems in practice.
But they are /not/ promoted! An integer is a specialized form of a rational.
I mean, you can even evaluate (denominator 11) and get 1.
| Also, is there one overarching reason why rationals aren't complex?
Huh? This is such a confused question. The mathematical background of the
Common Lisp numeric tower is reason enough. If you want complex numbers
with a rational number for the real and imaginary part, you got it. I do not
understand what the question would otherwise mean.
--
Erik Naggum, Oslo, Norway
Act from reason, and failure makes you rethink and study harder.
Act from faith, and failure makes you blame someone and push harder.