simplify
This commit is contained in:
parent
9901fc04a0
commit
718a278f97
1 changed files with 2 additions and 9 deletions
|
@ -56,16 +56,9 @@ lastMaybe v = Just $ Prelude.last v
|
||||||
- (Like init, but no error on an empty list.) -}
|
- (Like init, but no error on an empty list.) -}
|
||||||
beginning :: [a] -> [a]
|
beginning :: [a] -> [a]
|
||||||
beginning [] = []
|
beginning [] = []
|
||||||
beginning (x:xs) = beginning' x xs
|
beginning l = Prelude.init l
|
||||||
where
|
|
||||||
beginning' _ [] = []
|
|
||||||
beginning' y (z:zs) = y : beginning' z zs
|
|
||||||
|
|
||||||
{- Like last, but no error on an empty list. -}
|
{- Like last, but no error on an empty list. -}
|
||||||
end :: [a] -> [a]
|
end :: [a] -> [a]
|
||||||
end [] = []
|
end [] = []
|
||||||
end (x:xs) = end' x xs
|
end l = [Prelude.last l]
|
||||||
where
|
|
||||||
end' y [] = [y]
|
|
||||||
end' _ (y:ys) = end' y ys
|
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue