On Fri, Jan 11, 2008 at 09:17:28PM -0800, [EMAIL PROTECTED] wrote:
(2) Functions and data are not essentially the same thing any more than nouns and verbs are essentially that same thing. They can only be *represented* by the same language/alphabet.
I don't think this is quite their point. The idea, especially with scheme (and not as much with common lisp) is that a function is a first class piece of data that you can use. It's kind of like function pointers in C, since you _can_ call a C function pointer using the same syntax as calling a main function. But, since functions in Scheme have closures (which CL has too, BTW), the "thing" that is stored in your variable is a combination of both the code it's data together. It's a similar abstraction to OO, except with a different emphasis. OO focuses on the particular _thing_ (it is noun oriented) and there are a set of verbs associated with that. Python even makes it clear what is going on when you invoke a method, there is just an extra argument to the function that carries the object. With a functional language, the closure is created automatically, and it's the function that you think of (verb oriented). SICP gets into this in plenty of detail when they talk about OO. Basically, if a set of functions access the same group of values, and you group them together, you can treat it kind of like an object. Typical programming in scheme will involve lots of functions used as first class objects. C programmers often get a little scared of them. Dave -- [email protected] http://www.kernel-panic.org/cgi-bin/mailman/listinfo/kplug-lpsg
