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

Lambda calculus, Type theory, Formal semantics, Program analysis

    Prev     Next     All lectures        Code

Macros in the Scheme language

(define-syntax ceil_div
  (syntax-rules ()
    ((ceil_div x y) (/ (- (+ x y) 1) y))))

(define main
  (lambda ()
    (let ((b 3) (c 1))
      (ceil_div (bitwise-and b c) 8))))
 -  The corresponding ceil_div macro in Scheme does not have the problem that was noticed in the C version.