-- -- This file has been auto-generated by egison-translator. -- def points : [(Integer, Integer)] := [(3, 1), (4, 5), (7, 7), (8, 1), (1, 9), (3, 8), (3, 1)] def onALine? : ((Integer, Integer), (Integer, Integer), (Integer, Integer)) -> Bool := \match as ((integer, integer), (integer, integer), (integer, integer)) with | (($x1, $y1), ($x2, $y2), ($x3, $y3)) -> equal (abs (* (- y2 y1) (- x3 x1))) (abs (* (- y3 y1) (- x2 x1))) -- Enumerate triangles -- Expected: [((3, 1), (4, 5), (7, 7)), ((3, 1), (4, 5), (8, 1)), ...] matchAll points as list (integer, integer) with | _ ++ $p1 :: _ ++ $p2 :: _ ++ (!?1#(onALine? p1 p2 $1) & $p3) :: _ -> (p1, p2, p3) -- Enumerate triplets of points on a line -- Expected: [((3, 1), (4, 5), (1, 9)), ((3, 1), (4, 5), (3, 1)), ...] matchAll points as list (integer, integer) with | _ ++ $p1 :: _ ++ $p2 :: _ ++ (?1#(onALine? p1 p2 $1) & $p3) :: _ -> (p1, p2, p3)