Skip to content

Instantly share code, notes, and snippets.

@yangsu
Last active December 16, 2015 14:09
Show Gist options
  • Save yangsu/5447078 to your computer and use it in GitHub Desktop.
Save yangsu/5447078 to your computer and use it in GitHub Desktop.
Haskell Tuples
Prelude> zip [1 .. 5] ["one", "two", "three", "four", "five"]
[(1,"one"),(2,"two"),(3,"three"),(4,"four"),(5,"five")]
Prelude> let rightTriangles' = [ (a,b,c) | c <- [1..10], b <- [1..c], a <- [1..b], a^2 + b^2 == c^2]
Prelude> rightTriangles'
[(3,4,5),(6,8,10)]
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment