Return Styles: Pseud0ch, Terminal, Valhalla, NES, Geocities, Blue Moon. Entire thread

The Great Debate

Name: Anonymous 2012-10-24 2:45

(define (f x)
  ...)


or

(define f (lambda (x)
  ...)

Name: Anonymous 2012-10-24 3:00

Scheme's syntactic sugar for function definitions is quite brilliant because not only does the function definition match the function call (i.e. (define (f x) ...) => (f x) in Scheme vs. (defun f (x) ..) => (f x) in Common Lisp), but if implemented correctly if can be layered to create simplified higher-order functions.

]=> (define ((make-adder x) y)
      (+ x y))
make-adder
]=> (define add-3 (make-adder 3))
add-3
]=> (add-3 4)
7

Newer Posts
Don't change these.
Name: Email:
Entire Thread Thread List