[Haskell-cafe] Haskell-Newbie and Char-Function

Chaddaï Fouché chaddai.fouche at gmail.com
Sun Dec 6 14:46:38 EST 2009

On Sat, Dec 5, 2009 at 10:02 PM, ??????? ?????? <me at rkit.pp.ru> wrote:
> fct a n = (snd $ break (==a) ['a'..'z']) !! n

Not bad but you forgot that it might need to wrap around, besides
break isn't really the best function to use here since we don't need
the first part of the pair :

> shift n ch = dropWhile (/=ch) (cycle ['a'..'z']) !! n

Still I think the ord and mod version will be faster.


More information about the Haskell-Cafe mailing list