[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

data structures <--> functions



    Date: Sat, 5 Dec 87 14:06:59 +0100
    From: Oliver Laumann <net%TUB.BITNET at MITVMA.MIT.EDU>
    To:   scheme-request at mc.lcs.mit.edu

    In Scheme you can easily achieve this by first evaluating the list and then
    applying the result (a procedure) to the argument 45.  Try the following:

	 (define add2 '(lambda (x) (+ 2 x)))
	 ((eval add2 (the-environment)) 45)            -->  47

There is some disagreement here over what exactly "Scheme" means.  The
Revised^3 Report has no EVAL procedure, and no (THE-ENVIRONMENT) special
form, but most Scheme implementations, apparently including the one
you're referring to, do have some kind of EVAL.

There were several reasons for excluding EVAL from the report, including
  (a) there is no general agreement among Scheme designers as to what
      environment EVAL should evaluate expressions with respect to, or
      whether EVAL should take an explicit environment object as an
      argument;
  (b) it is not clear how to give a formal semantics to EVAL;
  (c) EVAL interacts poorly with selective linking.
On the other hand, EVAL is undeniably useful in particular special
situations.  (Most of the time that one would be tempted to use EVAL in
ancient Lisps, procedures or ad-hoc interpreters will serve in Scheme.)
EVAL will probably continue to be supported as an unofficial extension in
most implementations for the foreseeable future, and it will probably
continue to not be standardized for a while.  The same is true of
macros.  This is what happens when a standard is created by a committee.