Created
October 13, 2011 07:06
-
-
Save ejamesc/1283621 to your computer and use it in GitHub Desktop.
Stupid Haskell Insert Using foldr
This file contains 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
-- PS5 Problem 1 | |
insert a pos l = | |
fst ( foldr | |
(\x (b,c) -> (if c==pos-1 then a:x:b else x:b, c+1 )) | |
((drop pos [a]),0) l) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment