Sha256: 1b5e7fb25bfc67bc82c9856d781353fc7bf6691d9085fec6e3887da2345fa507
Contents?: true
Size: 742 Bytes
Versions: 21
Compression:
Stored size: 742 Bytes
Contents
import sequtils proc valid(a, b, c: int): bool = let greatThenZero = all([a, b, c], proc (x: int): bool = return x > 0) let equalityCheck = (a + b >= c) and (a + c >= b) and (b + c >= a) greatThenZero and equalityCheck proc is_equilateral*(sides: array[3, int]): bool = let a = sides[0] let b = sides[1] let c = sides[2] valid(a, b, c) and all(sides, proc (x: int): bool = return a == x) proc is_isosceles*(sides: array[3, int]): bool = let a = sides[0] let b = sides[1] let c = sides[2] valid(a, b, c) and (a == b or b == c or a == c) proc is_scalene*(sides: array[3, int]): bool = let a = sides[0] let b = sides[1] let c = sides[2] valid(a, b, c) and not is_isosceles(sides)
Version data entries
21 entries across 21 versions & 1 rubygems