[quiz] Re: (Partial?) solution to the second quiz
Marco Baringer
mb at bese.it
Tue May 9 09:21:52 UTC 2006
"Pablo Barenbaum" <foones at gmail.com> writes:
> I post a partial solution to the off-side-reader quiz.
> I say "partial" because, even though it reads in off-side mode,
> I'm not sure if it works as it is supposed in every case, i.e.:
> - what about blank lines?
ignore them.
> - what about comments?
interesting question. i'd say that you can just ignore both ; and #|
style comments. handling them makes for a good bonus question.
> - the !# is supposed to be alone in a single line?
yes. i assumed, though did not explicitly state, that the opening #!
and closing !# would be be themselves an a single line.
> I'm afraid I tend overuse format and loop.
:)
> It is also possibly very inefficient: it generates a new string
> with the "correct", inherent, parens made explicit, then reads it.
that sounds like a perfectly good technique to me, don't worry about
the efficency of it.
--
-Marco
Ring the bells that still can ring.
Forget the perfect offering.
There is a crack in everything.
That's how the light gets in.
-Leonard Cohen
More information about the Quiz
mailing list