Question: Define a Common Lisp macro named threeWayBranch which takes three parameters, x y and toExecute. x and y will be numbers and toExecute a list

Define a Common Lisp macro named threeWayBranch which takes three parameters, x y and toExecute. x and y will be numbers and toExecute a list with three sublists. The threeWayBranch macro will execute statements in toExecutes first sublist if x < y, the second sublist if x > y, and the third sublist if x = y. Assume each of toExecutes sublists contain an arbitrary number of statements.

;threeWayBranch (threeWayBranch 2 3 ( ((print "Hello")) ((print "Hello")(print "World")) ((print "!")) ) ) ;"Hello" (threeWayBranch 3 2 ( ((print "Hello")) ((print "Hello")(print "World")) ((print "!")) ) ) ;"Hello" "World" (threeWayBranch 3 3 ( ((print "Hello")) ((print "Hello")(print "World")) ((print "!")) ) ) ;"!"

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!