Question: USING SCHEME LANGUAGE Implement def, which simulates a python def statement, allowing you to write code like (def f(x y) (+ x y)). (define-macro (

USING SCHEME LANGUAGE

Implement def, which simulates a python def statement, allowing you to write code like (def f(x y) (+ x y)).

(define-macro (def func bindings body)

'YOUR-CODE-HERE

)

Previously, my code is:

(define-macro (def func bindings body) `(begin (define-macro ,(cons 'x bindings) ,body) x))

However, the test case

(def f(x y) (+ x y))

expected f, while my code above got (lambda (x y) (+ x y))

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Databases Questions!