[Haskell-cafe] uncommon IMO problem - toilet management
Thomas Hartman
tphyahoo at gmail.com
Sat Jul 18 15:12:08 EDT 2009
I enjoyed learning from this app and seeing monad transformers in
action. One nit, the parsing seems a bit wonky
It would be nice to use parsec here, perhaps, rather than this hand
rolled, and complain about input that can't be parsed rather than just
say "toilet free" or whatever is going on here.
thartman at ubuntu:~/tmp>toilet
asdf 123
ASDF 123 enters toilet at 21:08
asdf 123 123
toilet blocked by ASDF123 since 21:08
asdf 124 123
toilet blocked by ASDF123 since 21:08
asdf 123
ASDF 123 leaves toilet at 21:09
asdf 124 123
toilet free
asdf 124
ASDF 124 enters toilet at 21:09
1234 124 124
toilet free
asdf 124
ASDF 124 leaves toilet at 21:09
2009/7/17 Henning Thielemann <lemming at henning-thielemann.de>:
>
> In the last two days I was invigilator at the International Mathematic
> Olympics 2009 in Bremen, Germany. There we got a problem different from the
> official math problems. :-) Eventually I solved it using Haskell. Read the
> detailed description at
> http://hackage.haskell.org/package/toilet-0.0.1
>
> I think the problem is simple enough to be used in education of programming.
>
> (I also think it would have been better to avoid monads and use lazy list
> processing.)
> _______________________________________________
> Haskell-Cafe mailing list
> Haskell-Cafe at haskell.org
> http://www.haskell.org/mailman/listinfo/haskell-cafe
>
More information about the Haskell-Cafe
mailing list