Skip to content

Instantly share code, notes, and snippets.

@dtak1114
Created May 21, 2013 04:19
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save dtak1114/5617460 to your computer and use it in GitHub Desktop.
Save dtak1114/5617460 to your computer and use it in GitHub Desktop.
pair func in haskell
pair f [] = []
pair f (x:[]) = []
pair f (x:xs:xss) = [f x xs] ++ pair f xss
-- assure that pair returns list
list = [1,2,3,4,5,6]
@dtak1114
Copy link
Author

:l pair.hs
pair (+) list
let sub x y = x - y
pair sub [0..20]
pair sub [0..21]

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment