20-CS-4003-001 Organization of Programming Languages Fall 2017
Lambda

Lambda calculus, Type theory, Formal semantics, Program analysis

    Prev     Next     All lectures           Code

Lambda - Y Combinator

(define F
  ((lambda (func-arg)
     (lambda (n)
       (if (zero? n)
           1
           (* n (func-arg (- n 1))))))
   (lambda (arg) ((procedure procedure) arg))))
 -  How has this helped? Well, the (lambda (arg)...) is ONE procedure and procedures can be passed as arguments so F can be defined as shown to the left. Yes, it's the same F but the old definition looked like this:
  (define F (lambda (n) ... <procedure>))
and the new definition looks like this:
  (define F ((lambda (func-arg) (lambda (n) ...)) <procedure>))
where <procedure> is the (lambda (arg) ((procedure... ) ...) ...) expression.