Created
May 7, 2014 13:31
-
-
Save loosechainsaw/4ea81b50f78f944377ab to your computer and use it in GitHub Desktop.
Haskell Implementation of Split At
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
seperateAt :: Int -> [a] -> ([a],[a]) | |
seperateAt 0 [] = ([], []) | |
seperateAt 0 xs = ([], xs) | |
seperateAt n (x: []) = (x : [], []) | |
seperateAt n (x:xs) = | |
let result = (seperateAt (n - 1) xs) | |
in (x : fst result, snd result) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment