|
|
Function definition in Scheme |
A function object can be bound to a name via define like any other kind of value. But we often use a slightly different, equivalent syntax for function definitions, where the 'lambda' is implicitly specified |
| The ordinary way to bind f to the value of a lambda expressions |
| An equivalent syntactic sugaring with a more shallow parenthesis structure.
Whenever Scheme identifies a list at the 'name place' in a define form, it carries out the transformation
(define (f p1 p2) ...) => (define f (lambda (p1 p2) ...)) . Some Scheme programmers like the form (define (f p1 p2) ...) because the calling form (f p1 p2) is a constituent of the
form (define (f p1 p2) ...) |