David Brown wrote:
>..
> The simple rule in scheme is that a form consists of
> 
>   - A number, string, and some other things: evalutes to itself.
>   - A symbol: It is looked up via various rules to get a value.
>   - A list of forms in parens: The first form must evaluate to a function
>     which is called (applied) to the given arguments.  This is a function
>     call.
>   - Some other things we'll get to later.
> 
> Notice that the definition is recursive.  Each of the things in the parens
> is another form.
> 
> In scheme, there is nothing special about the first term in a function
> call expression.  It is often a symbol that comes from the global symbol
> table, but it doesn't have to be.  It could be a locally defined symbol, or
> even another expression in parens that computes a function.
> 
>> ** Also, what is the type of "define"?  You cannot evaluate "define"
>> so it
>>   can't be a regular function.
>>
>> 1 ]=> define
> 
> Notice that the rules above always look up symbols when they are
> encountered.  We need to have some way to define new symbols, or our
> program couldn't be more than one (possibly large) expression based on
> existing definitions.
> 
> Hence, special forms (pardon my lisp terminology if Scheme uses different
> names for these things).  'define' is special in that it doesn't evaluate
> it's arguments.  Instead, it looks at them unevaluated and uses that to
> make a definition.  Depending on what the first argument looks like, it
> might create a function definition, or it might evaluate the second
> argument.
> 
> Macros are how the user can create definitions.  I don't think Macros are
> covered in SICP.  But, the Scheme implementer had to create some of these
> or we would never get anywhere.
> 
> Another very useful special form is "quote".  What if I don't want to
> evaluate an expression.  I can use the quote special form to not evaluate
> it:
> 
>   > (quote (+ 1 2))
>   (+ 1 2)
> 
> This is used often enough, that there is a special shortcut.  The above is
> equivalent to:
> 
>   > '(+ 1 2)
>   (+ 1 2)

Nice summary, Dave. Maybe you could post this somewhere. I've forgotten,
 did Mark set up some kind of wiki gathering spot? Mark?

  (kplug wiki is certainly available for such things.)

Regards,
..jim

-- 
[email protected]
http://www.kernel-panic.org/cgi-bin/mailman/listinfo/kplug-lpsg

Reply via email to