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
display "the list is very long"
display "more than elements
'biglist
else
display "the list is small"
'smallist
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 syntaxcases, BUT to do so requires far more trickiness than the problem deserves. Instead, use syntaxdatum to turn the input code into a list, transform it and then use datumsyntax to convert it back again.
Step by Step Solution
There are 3 Steps involved in it
1 Expert Approved Answer
Step: 1 Unlock
Question Has Been Solved by an Expert!
Get step-by-step solutions from verified subject matter experts
Step: 2 Unlock
Step: 3 Unlock
