Sha256: dff95e7deb88dec85dd58cc8143674ce61c591c5cc3d13ec976b701ea717e6e0

Contents?: true

Size: 416 Bytes

Versions: 151

Compression:

Stored size: 416 Bytes

Contents

open Core

let sort_sides a b c = 
  let side = List.nth_exn (List.sort ~cmp:Int.compare [a; b; c]) in
  (side 0, side 1, side 2)

let is_triangle a b c = 
  let (a, b, c) = sort_sides a b c in
  c > 0 && c <= a + b

let is_equilateral a b c = is_triangle a b c && a = b && b = c

let is_isosceles a b c = is_triangle a b c && (a = b || b = c || a = c)

let is_scalene a b c = is_triangle a b c && (a <> b && b <> c)

Version data entries

151 entries across 151 versions & 1 rubygems

Version Path
trackler-2.2.1.110 tracks/ocaml/exercises/triangle/example.ml
trackler-2.2.1.109 tracks/ocaml/exercises/triangle/example.ml
trackler-2.2.1.108 tracks/ocaml/exercises/triangle/example.ml
trackler-2.2.1.107 tracks/ocaml/exercises/triangle/example.ml
trackler-2.2.1.106 tracks/ocaml/exercises/triangle/example.ml
trackler-2.2.1.105 tracks/ocaml/exercises/triangle/example.ml
trackler-2.2.1.104 tracks/ocaml/exercises/triangle/example.ml
trackler-2.2.1.103 tracks/ocaml/exercises/triangle/example.ml
trackler-2.2.1.102 tracks/ocaml/exercises/triangle/example.ml
trackler-2.2.1.101 tracks/ocaml/exercises/triangle/example.ml
trackler-2.2.1.100 tracks/ocaml/exercises/triangle/example.ml
trackler-2.2.1.99 tracks/ocaml/exercises/triangle/example.ml
trackler-2.2.1.98 tracks/ocaml/exercises/triangle/example.ml
trackler-2.2.1.97 tracks/ocaml/exercises/triangle/example.ml
trackler-2.2.1.96 tracks/ocaml/exercises/triangle/example.ml
trackler-2.2.1.95 tracks/ocaml/exercises/triangle/example.ml
trackler-2.2.1.94 tracks/ocaml/exercises/triangle/example.ml
trackler-2.2.1.93 tracks/ocaml/exercises/triangle/example.ml
trackler-2.2.1.92 tracks/ocaml/exercises/triangle/example.ml
trackler-2.2.1.91 tracks/ocaml/exercises/triangle/example.ml