On Sat, Dec 5, 2009 at 4:48 PM, Jochem Berndsen <[email protected]> wrote: > MeAdAstra wrote: >> Hi guys, >> I only started learning Haskell some days ago. Maybe one of you can give me >> a hint on how to implement a function that needs a character in the range >> (a,b,...z) and an integer number k and returns the k-next neighbor of the >> character? For example, fct a 5 would result in output f. > > You might want to use the functions ord and chr from Data.Char, and the > mod function from the Prelude.
Right, and by the way I would suggest you reverse the parameter order of your function so that it takes the shift first, then you can write : > shift :: Int -> Char -> Char > shift n c ... > > rot13 :: String -> String > rot13 = map (shift 13) -- Jedaï _______________________________________________ Haskell-Cafe mailing list [email protected] http://www.haskell.org/mailman/listinfo/haskell-cafe
