Relay-Version: version B 2.10 5/3/83; site utzoo.UUCP Path: utzoo!mnetor!uunet!husc6!mit-eddie!ll-xn!ames!ucbcad!ucbvax!AI.AI.MIT.EDU!JAR From: JAR@AI.AI.MIT.EDU (Jonathan A Rees) Newsgroups: comp.lang.scheme Subject: data structures <--> functions Message-ID: <295045.871205.JAR@AI.AI.MIT.EDU> Date: Sat, 5-Dec-87 13:34:17 EST Article-I.D.: AI.295045.871205.JAR Posted: Sat Dec 5 13:34:17 1987 Date-Received: Thu, 10-Dec-87 19:36:38 EST References:Sender: daemon@ucbvax.BERKELEY.EDU Organization: The ARPA Internet Lines: 30 Date: Sat, 5 Dec 87 14:06:59 +0100 From: Oliver Laumann 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.