[Haskell-cafe] Haskell - string to list isusses, and more

Deniz Dogan deniz.a.m.dogan at gmail.com
Sun Jun 14 12:29:58 EDT 2009

2009/6/14 Toby Miller <toby at miller.ms>:
> Here's what I came up with.  I especially like the 2nd version, even though
> it's longer, as it seems very declarative.
> caps1 s = all (\x -> isUpper (head x)) (words s)
> caps2 s = all startsWithUpper (words s) where
>    startsWithUpper w = isUpper (head w)
> I'm also fairly new to Haskell, so I would appreciate feedback from the more
> experienced.
> Thanks.

Not that I'm very experienced myself, but I came up with the first idea as well:

caps1 = all (isUpper . head) . words

Deniz Dogan

More information about the Haskell-Cafe mailing list