Question
As I mentioned in class, the presence of macros in the lisp family of languages has led to many subtly-different implementations of the same concept.
As I mentioned in class, the presence of macros in the lisp family of languages has led to many subtly-different implementations of the same concept. Just as function definition isn't a fundamental operation (it is composed of definition and lambda), the let mechanism can be constructed from lambdaalone. The Clojure code
(let [x 10, y 20] (* x y))
is equivalent to
((fn [x y] (+ x y)) 10 20). Thus, many different implementations exist (In fact, some of the differences in let forms have been cited in the renaming of PLT Scheme to Racket (https://racket-lang.org/new-name.html)
Let's help make schemers more at home in Clojure with a macro that allows scheme-style macros to be used.
Rather than try to support both syntaxes from a single macro, you'll define a new one such that
(let-scm ((x 10) (y 20)) (+ x y))
is the same thing as
(let [x 10 y 20] (+ x y))
Step by Step Solution
There are 3 Steps involved in it
Step: 1
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started