Skip to content

Instantly share code, notes, and snippets.

@ejamesc
Created October 13, 2011 07:06
Show Gist options
  • Save ejamesc/1283621 to your computer and use it in GitHub Desktop.
Save ejamesc/1283621 to your computer and use it in GitHub Desktop.
Stupid Haskell Insert Using foldr
-- 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