To teach myself Logo I use a Dutch book.
It contains the following problem:
write a recursive function wich makes calculations;
for example [4 * 3 * [7 - [6/2]] outputs 48
or [[3 * 2] + [4 * 3] + [5 * 4]] outputs 27
or [5 + 4 * 3] outputs 17
but [[5 + 4] * 3] outputs 27
I need help on this one. I had the following strategy in mind:
first determine the 'deepest' list (in the first example [6/2])
second calculate the result and keep it in mind (here: 3)
third repeat step 1 and 2 for the next level (here [7 - 3]).
How do I determine that [6/2] is the 'deepest' list?
How do I make the calculations?
Any suggestions or solutions are welcome.
H.Hoenjet@inter.NL.net
---------------------------------------------------------------
Please post messages to the Logo forum to logo-l@gsn.org. Mail
questions about the list administration to logofdn@gsn.org. To
unsubscribe send unsubscribe logo-l to majordomo@gsn.org.