Sha256: 018cfd843795cfa8874c92243ff714253e7d74818eb54852cd3ff00f1e7326b7

Contents?: true

Size: 420 Bytes

Versions: 42

Compression:

Stored size: 420 Bytes

Contents

open Base

let sort_sides a b c = 
  let side = List.nth_exn (List.sort ~compare: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

42 entries across 42 versions & 1 rubygems

Version Path
trackler-2.2.1.180 tracks/ocaml/exercises/triangle/example.ml
trackler-2.2.1.179 tracks/ocaml/exercises/triangle/example.ml
trackler-2.2.1.178 tracks/ocaml/exercises/triangle/example.ml
trackler-2.2.1.177 tracks/ocaml/exercises/triangle/example.ml
trackler-2.2.1.176 tracks/ocaml/exercises/triangle/example.ml
trackler-2.2.1.175 tracks/ocaml/exercises/triangle/example.ml
trackler-2.2.1.174 tracks/ocaml/exercises/triangle/example.ml
trackler-2.2.1.173 tracks/ocaml/exercises/triangle/example.ml
trackler-2.2.1.172 tracks/ocaml/exercises/triangle/example.ml
trackler-2.2.1.171 tracks/ocaml/exercises/triangle/example.ml
trackler-2.2.1.170 tracks/ocaml/exercises/triangle/example.ml
trackler-2.2.1.169 tracks/ocaml/exercises/triangle/example.ml
trackler-2.2.1.167 tracks/ocaml/exercises/triangle/example.ml
trackler-2.2.1.166 tracks/ocaml/exercises/triangle/example.ml
trackler-2.2.1.165 tracks/ocaml/exercises/triangle/example.ml
trackler-2.2.1.164 tracks/ocaml/exercises/triangle/example.ml
trackler-2.2.1.163 tracks/ocaml/exercises/triangle/example.ml
trackler-2.2.1.162 tracks/ocaml/exercises/triangle/example.ml
trackler-2.2.1.161 tracks/ocaml/exercises/triangle/example.ml
trackler-2.2.1.160 tracks/ocaml/exercises/triangle/example.ml