Hints for the Challenge:

Below, you can find another hint for the Challenge.

You should only get here after reading, digesting, and applying the .

Hint

A little bit of care is needed, because after the final newline marker it is unnecessary to introduce a plus symbol to prepare for another line with a string literal. On the other hand, it does not matter much if the last line of the string literal consists of an empty string, i.e. '';. An even better solution might be to do the line break just before the newline marker (we'll do that).

To keep this work textually separated from the other loop, in which it needs to be executed, it is better to incorprate the writing in a separate function:

We can easily test it by prepending the definition of S and invoking the new function copy():

This outputs ():

Can you develop this idea into a solution?

Try your program in the machine, and see if you can extend it to a complete solution.

Apply the Hint

It is your turn ...

Need Another Hint?

If you tried this hint, or do not see how it helps, then you are ready for the .


Valid HTML 4.01 Transitional

Copyright ©2009, Tom Verhoeff, T.Verhoeff@TUE.NL