Skip to content

Commit

Permalink
added myAppend
Browse files Browse the repository at this point in the history
  • Loading branch information
amidvidy committed Aug 15, 2012
1 parent 74a801f commit d09d2ad
Showing 1 changed file with 5 additions and 0 deletions.
5 changes: 5 additions & 0 deletions real-world-haskell/ch4/myListFunctions.hs
Original file line number Diff line number Diff line change
Expand Up @@ -32,3 +32,8 @@ myInit :: [a] -> [a]
myInit [x] = []
myInit (x:xs) = x : myInit xs

-- same as '(++)'
myAppend :: [a] -> [a] -> [a]
myAppend [] b = b
myAppend a [] = a
myAppend a b = myAppend (myInit a) ((myLast a) : b)

0 comments on commit d09d2ad

Please sign in to comment.