Com S 342 meeting -*- Outline -*- * The define sugar in Scheme It's helpful to have this example handy for the summary that follows. ** problem ------------------------------------------ PROBLEM Tedious syntax, common pattern (define square (lambda (x) (* x x))) (define compose (lambda (f g) (lambda (x) (f (g x))))) ------------------------------------------ ------------------------------------------ SUGAR FOR DEFINE IN SCHEME (define (square x) (* x x)) (define (compose f g) (lambda (x) (f (g x)))) Desugaring rule: (define (name v1 ...) body) ==> ------------------------------------------ ... (define name (lambda (v1 ...) body)) Q: What are the advantages of this?