- Country :
United States America
Connect with Assignment Expert Now
Assignment Task
Code the macro, iterate, which is based on the following:
(iterate controlVariable beginValueExpr endValueExpr incrExpr bodyexpr1 bodyexpr2 … bodyexprN)
iterate is passed a controlVariable which is used to count from beginValueExpr to endValueExpr (inclusive) by the specified increment.
For each iteration, it evaluates each of the one or more body expressions.
Since beginValueExpr, endValueExpr, and incrExpr are expressions, they must be evaluated.
The endValueExpr and incrExpr are evaluated before processing the rest of the macro. This means the code within the user’s use of the macro cannot alter the termination condition nor the increment; however, it can change the value of the controlVariable.
The functional return value of iterate macro doesn’t matter, and will probably be T.
You can create an intermediate variable named endValue for the endValueExpr. You can create an intermediate variable named incValue for the incrExpr. For 5 bonus points, use gensym to generate the name of those two variables.
The “T” printed at the end of each of these is irrelevant. Yours can print “NIL” or nothing, doesn’t matter.
Examples:
1. > (iterate i 1 5 1
(print (list ‘one i))
)
(one 1)
(one 2)
(one 3)
(one 4)
(one 5)
T
2. > (setf n 5)
5
> (iterate i 1 n 1
(print (list ‘two i n))
(+= i 1)
)
(two 1 5)
(two 3 5)
(two 5 5)
T
3. > (setf n 5)
5
> (iterate i 1 n 1
(print (list ‘three i n))
(+= n 1)
)
(three 1 5)
(three 2 6)
(three 3 7)
(three 4 8)
(three 5 9)
T
4. > (setf n 5)
5
> (setf inc 2)
2
> (iterate i 1 n inc
(print (list ‘three i n inc))
(+= inc 1)
)
(three 1 5 2)
(three 3 5 3)
(three 5 5 4)
T
This IT Assignment has been solved by our IT experts at Schooling Best. Our Assignment Writing Experts are efficient to provide a fresh solution to this question. We are serving more than 10000+ Students in Australia, UK & US by helping them to score HD in their academics. Our Experts are well trained to follow all marking rubrics & referencing style.
Be it a used or new solution, the quality of the work submitted by our assignment experts remains unhampered. You may continue to expect the same or even better quality with the used and new assignment solution files respectively. There’s one thing to be noticed that you could choose one between the two and acquire an HD either way. You could choose a new assignment solution file to get yourself an exclusive, plagiarism (with free Turnitin file), expert quality assignment or order an old solution file that was considered worthy of the highest distinction.
-
Uploaded By : Brett
-
Posted on : December 23rd, 2019
-
Downloads : 0
Order New Solution
Can’t find what you’re looking for?
This Christmas, The Most Magical Time of The Year, save up to 65% on Our one-to-one Academic Assistance.
Grab Now