[Haskell-cafe] RE: Haskell Pangolins

Dominic Fox dominic.fox1 at ntlworld.com
Thu Dec 30 07:06:24 EST 2004


The use of elem is certainly more concise. But this isn't quite right (Hugs
rejects it):

>	isYes = `elem` ["y", "yes", "Y", "YES"]

I think what's meant is:

	isYes = flip elem ["y", "yes", "Y", "YES"]

and agree that

	isYes = flip elem ["y", "yes"] . (map toLower)

is even better.

> Of course, the very last "if" could be,
>
>	if isYes playAgain
>		then play rewrittenNode
>		else putStr "Goodbye for now."

I had it the other way around because of a vague notion about tail-recursion
that perhaps doesn't apply here?

It's useful to know where "do"s and parentheses are not needed. I agree
about records; I thought they would be useful, and ended up not using them.

Derek's use of LiftM is new to me, as most things in Haskell are. The @
operator (fullstring@(c:cs)) looks very handy.

Thanks to all,
Dominic



More information about the Haskell-Cafe mailing list