[EMAIL PROTECTED] wrote:
I'm trying to understand first few pages of SICP where they explain
Scheme basics and had some newbie questions about evaluation....
** First of all, whenever you define a new function, the function's name and
function's code are stored in the "global environment". I thought
functional programming meant you weren't allowed to have any state. Yet,
modifying a "global environment" means changing state!?!?!?
Scheme is not a purely functional language so you can have mutable
state. Something like Haskell is purely functional and has no mutable
state. However, in functional programming you can often define a new
function and store it in the environment and then not be able to modify
it. Sort of like assign-once. I don't think scheme is this way but
Erlang is.
** Does the evaluation of functions return some mysterious type of object?
What the heck is going on? For example, look at evaluation of "+"...
As Brad said, + is a built in. It works like a function and could be
defined in terms of car's and cdr's but they have optimized it for speed.
** Also, what is the type of "define"? You cannot evaluate "define" so it
can't be a regular function.
It isn't. It is a syntactic keyword just like the error says. Scheme has
very few of these which is why it is so easy to learn the syntax of Scheme.
--
Tracy R Reed Read my blog at http://ultraviolet.org
Key fingerprint = D4A8 4860 535C ABF8 BA97 25A6 F4F2 1829 9615 02AD
Non-GPG signed mail gets read only if I can find it among the spam.
--
[email protected]
http://www.kernel-panic.org/cgi-bin/mailman/listinfo/kplug-lpsg