Macros: Conceptual
Code Writing
Define a macro composite-function that takes in three functions, ftn1, ftn2, and ftn3, and an x and applies each function to x starting from ftn1
> (define (f1 x) (+ x 1))
> (define (f2 x) (* x 2))
> (define (f3 x) (- x 3))
> (composite-ftn f1 f2 f3 5)
9
(define-macro (composite-function ftn1 ftn2 ftn3 x)
______)
Write a list comprehension macro that takes in a list of numbers and adds 1 to each element in the list.
> (define lst '(1 2 3 4 5))
> (list-comprehension lst)
(2 3 4 5 6)
(define-macro (list-comprehension lst)
______