Question: So this one is simple conceptually ( ifelse testexp thenexps else elseexps ) Example: ( ifelse ( > ( length mylist ) 1 0 )

So this one is simple conceptually
(ifelse testexp thenexps else elseexps)
Example:
(ifelse
(>(length mylist)10)
(display "the list is very long")
(display "more than 10 elements)
'biglist
else
(display "the list is small")
'smal1list)
There can be any number of thenexps and elseexps BUT there is always at least one of each. eqse is a special keyword that separates thenexps from elseexps. It acts like an normal if with then statements and else statements in begin blocks.
This problem can be solved with syntax-cases, BUT to do so requires far more trickiness than the problem deserves. Instead, use syntax->datum to turn the input code into a list, transform it, and then use datum->syntax to convert it back again.
 So this one is simple conceptually (ifelse testexp thenexps else elseexps)

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!