#lang racket (define-syntax with (syntax-rules (=) [(_ (name = rhs) ... body) ((lambda (name ...) body) rhs ...)] ;; these were recursive: #;([(_ body) body] [(_ (name = rhs) rest ...) ((lambda (name) (with rest ...)) rhs)]) ;; this one was for one clause only: #;[(_ (name = rhs) body) ;; <-- something like this ((lambda (name) body) rhs)])) ;; <-- should turn into this (define-syntax add4 (syntax-rules () [(_ x) (+ x 4)])) (add4 16) (with (t = 19) (u = 193) (* t u)) (define-syntax bogus (syntax-rules () [(_ x) (let ((z 9)) (+ x z))])) (let ((z 12)) (bogus z))