all tasks
This commit is contained in:
parent
b83f433714
commit
68f8f3e56b
14735 changed files with 178959 additions and 0 deletions
|
|
@ -0,0 +1,18 @@
|
|||
-- We define the functions to return an empty string if the argument is too
|
||||
-- short for the particular operation.
|
||||
|
||||
remFirst, remLast, remBoth :: String -> String
|
||||
|
||||
remFirst "" = ""
|
||||
remFirst cs = tail cs
|
||||
|
||||
remLast "" = ""
|
||||
remLast cs = init cs
|
||||
|
||||
remBoth (c:cs) = remLast cs
|
||||
remBoth _ = ""
|
||||
|
||||
main :: IO ()
|
||||
main = do
|
||||
let s = "Some string."
|
||||
mapM_ (\f -> putStrLn . f $ s) [remFirst, remLast, remBoth]
|
||||
Loading…
Add table
Add a link
Reference in a new issue