Re: compare function return values
Per Bothner 06 Jun 2005 23:59 UTC
bear wrote:
> Hooboy. Is this an actual scheme implementation? I haven't looked at
> others, but I can't store the overhead involved with a symbol (scopes,
> locations, lexical contours, contexts, variable values, weak references,
> etc) in less than 64 bytes. Am I just doing something horribly wrong?
Well, we all make tradeoffs. But having a "lexical contour" field in
a symbol is at best an efficiency hack. A cleaner solution is a
lexical counter hash table indexed by the symbol.
Common Lisp's "value binding" (and function binding) components are
also a hack. For one thing they don't work with multiple threads.
> I agree that the numbers don't express the values you actually mean
> here, and I dislike that semantic untidiness. To say "-1" when I
> mean "increasing" is as irritating as saying "27" when I mean "escape"
> or 'a' when I mean "43" or "0" when I mean "false." The only reason
> to put up with this semantic blurring, IMO, is because you can use
> numbers to index arrays or in further computations, and because doing
> so is the most straightforward and useful way to use those results.
Well, using {-1, 0, 1} is fairly conventional in other languages
(including C, C++, and Java), and there is the mathematical signum
function. There is something to be said for stick with what works.
Plus using a symbol is awkward because it is hard to avoid it
being human-langauge-specific - unless you use '<, '=, and '> I guess.
Let's stick with {-1, 0, 1}.
--
--Per Bothner
xxxxxx@bothner.com http://per.bothner.com/