Subject: Re: what si the gain with lambda here?
From: rpw3@rpw3.org (Rob Warnock)
Date: Sun, 11 May 2008 22:55:13 -0500
Newsgroups: comp.lang.scheme
Message-ID: <T6OdndTFoZI8IrrVnZ2dnUVZ_t3inZ2d@speakeasy.net>
globalrev  <skanemupp@yahoo.se> wrote:
+---------------
| (define add2 (lambda (x) (+ x 2)))
| as opposed to (define (add2 x)  (+ x 2))
| what is the difference?
+---------------

None at all, at the top level of the REPL -- in that
case the latter is simply syntactic sugar for the former.
Note however that inside certain binding contours
[what is called a "<body>" in the EBNF] the latter
expands into a LETREC, not a top-level assignment.
See the following for the distinction between the two:

    http://www.schemers.org/Documents/Standards/R5RS/HTML/r5rs-Z-H-2.html
    5.2    Definitions
    5.2.1  Top level definitions
    5.2.2  Internal definitions

[And next time, try RTFM before asking such a question...]


-Rob

-----
Rob Warnock			<rpw3@rpw3.org>
627 26th Avenue			<URL:http://rpw3.org/>
San Mateo, CA 94403		(650)572-2607