RosettaCodeData/Task/List-comprehensions/OCaml/list-comprehensions-2.ocaml
2023-07-01 13:44:08 -04:00

6 lines
133 B
Text

let pyth n =
let* x = 1 -- n in
let* y = x -- n in
let* z = y -- n in
if x * x + y * y <> z * z then [] else
[x, y, z]