This assignment is due on April 7th.
I forgot the quote in front of the Lindenmayer rules.
Please read the first chapter ``Inductive Sets of Data'' in EOPL.
Question 1 (20 points)
Write a Scheme procedure create-lindenmayer-system that takes as parameter a Lindenmayer system in form of a start string and a list with the rules (see example below) and returns a procedure that takes an integer parameter and returns the turtle graphic instructions for that level. Example:
(define dragon
(create-lindenmayer-system
"FX" ; start string (level 0)
'( ; list of Lindenmayer rules
(#\X "X+YF+")
(#\Y "-FX-Y")
)
)
)
(dragon 3)
should return "F+F++-F-F++-F+F+--F-F+".
Question 2 (5 points)
Why is if directly supported by the language? Would it also be possible to write a new-if procedure yourself (without using define-syntax) that behaves like the original if? Show your version of new-if and discuss its possible limitations or explain why it cannot be done. (Remark: define-syntax is an extremely powerful macro mechanism which we will not explore in this course. You need just to consider the language constructs for this question that were introduced during the lectures).
Question 3 (5 points)
Write an And macro for the Lambda calculus that takes two Boolean arguments (should be either equivalent to True or False) and returns itself a function equivalent to True if and only if both arguments are true and false otherwise.
Example of its use:
(((If-then-else)((And)True)True)ok)failed
should evaluate to ``ok''.
Please submit everything in one email that includes all your answers in attachments. Multiple submission emails are permitted but then only the last one is considered.