On Fri, Jan 25, 2008 at 11:35:33PM -0800, [EMAIL PROTECTED] wrote:
If I'm not mistaken, what makes a special form to be special is that
evaluation happens abnormally....
(if (< x 0) "negative" "positive")
The only way I can see that "if" is special is that for an optimization it will
chose to not evaluate the last list element when the condition is TRUE.
Is that right?
Wouldn't it be better/more minimalistic to just always evaluate the last list
element to cut down on the number of "special forms" by 1?
You probably don't want
(if (x < 0) (exit-program))
to evaluate the argument until it knows if X is negative.
If your code is pure (the arguments have no side effects) if can evaluate
all arguments, but even that loses in efficiency. With side effects, it
can't evaluate them.
Also, remember that according to the definition of the language, 'if' is
the only conditional primitive, and all others are defined in terms of it
(again, probably not implemented that way).
There is also 'and', 'or', and 'case' which aren't strictly needed, but are
quite useful enough.
Remember, Scheme doesn't have as it's primary purpose to be minimal. Take
too much out, and the language because too hard to use. Some of the
minimalism is about the definition of the language. Practical
implementations will still give more definitions and other useful things.
Technically, the language doesn't need integers either, since those can be
implemented with lists of various lengths :-)
Dave
--
[email protected]
http://www.kernel-panic.org/cgi-bin/mailman/listinfo/kplug-lpsg