Sample.hs
import Data.Char offset :: Char -> Char -> Int offset c1 c2 = abs (ord c1 - ord c2)
Prelude> :load Sample.hs [1 of 1] Compiling Main ( Sample.hs, interpreted ) Ok, modules loaded: Main. *Main> *Main> offset 'a' 'b' 1 *Main> offset 'a' 'z' 25 *Main> offset 'n' 'a' 13 *Main> offset '*' 'a' 55
No comments:
Post a Comment