PRELUDE: add if' function to simplify if-then-else
This commit is contained in:
parent
077d0442f5
commit
9dcf1e30f9
@ -72,3 +72,9 @@ seqList = tail. inits
|
|||||||
dupLast :: [a] -> [a]
|
dupLast :: [a] -> [a]
|
||||||
dupLast [] = []
|
dupLast [] = []
|
||||||
dupLast xs = xs ++ [last xs]
|
dupLast xs = xs ++ [last xs]
|
||||||
|
|
||||||
|
|
||||||
|
-- |Simpler version of if-then-else.
|
||||||
|
if' :: Bool -> a -> a -> a
|
||||||
|
if' True x _ = x
|
||||||
|
if' False _ y = y
|
||||||
|
Loading…
Reference in New Issue
Block a user