StringsEqual.hs
stringsEqual :: String -> String -> Bool stringsEqual [] [] = True stringsEqual _ [] = False stringsEqual [] _ = False stringsEqual (x:xs) (y:ys) = (x == y) && stringsEqual xs ys
*Main> :load StringsEqual.hs [1 of 1] Compiling Main ( StringsEqual.hs, interpreted ) Ok, modules loaded: Main. *Main> *Main> stringsEqual [] [] True *Main> stringsEqual "Hello" "Hello" True *Main> stringsEqual "Hello" "Hello1" False *Main> stringsEqual "Hello1" "Hello" False *Main>
No comments:
Post a Comment