Idris2/samples/listcomp.idr

4 lines
145 B
Idris
Raw Normal View History

pythag : Int -> List (Int, Int, Int)
pythag n = [ (x, y, z) | z <- [1..n], y <- [1..z], x <- [1..y],
x*x + y*y == z*z ]