Sha256: 2f31cc8ad1593a66a0841c870f31e3a90e5a816d60ee50d60c7cb8650ce8872b

Contents?: true

Size: 406 Bytes

Versions: 84

Compression:

Stored size: 406 Bytes

Contents

-module(triangle).

-export([kind/3]).

kind(A,B,C) when (A =< 0) or (B =< 0) or (C =< 0) ->
    {error, "all side lengths must be positive"};
kind(A,B,C) when not ((A < (B + C)) and (B < (A + C)) and (C < (A + B))) ->
    {error, "side lengths violate triangle inequality"};
kind(A,A,A) -> equilateral;
kind(A,_,A) -> isosceles;
kind(A,A,_) -> isosceles;
kind(_,B,B) -> isosceles;
kind(_,_,_) -> scalene.

Version data entries

84 entries across 84 versions & 1 rubygems

Version Path
trackler-2.0.6.28 tracks/erlang/exercises/triangle/example.erl
trackler-2.0.6.27 tracks/erlang/exercises/triangle/example.erl
trackler-2.0.6.26 tracks/erlang/exercises/triangle/example.erl
trackler-2.0.6.25 tracks/erlang/exercises/triangle/example.erl
trackler-2.0.6.24 tracks/erlang/exercises/triangle/example.erl
trackler-2.0.6.23 tracks/erlang/exercises/triangle/example.erl
trackler-2.0.6.22 tracks/erlang/exercises/triangle/example.erl
trackler-2.0.6.21 tracks/erlang/exercises/triangle/example.erl
trackler-2.0.6.20 tracks/erlang/exercises/triangle/example.erl
trackler-2.0.6.19 tracks/erlang/exercises/triangle/example.erl
trackler-2.0.6.18 tracks/erlang/exercises/triangle/example.erl
trackler-2.0.6.17 tracks/erlang/exercises/triangle/example.erl
trackler-2.0.6.16 tracks/erlang/exercises/triangle/example.erl
trackler-2.0.6.15 tracks/erlang/exercises/triangle/example.erl
trackler-2.0.6.14 tracks/erlang/exercises/triangle/example.erl
trackler-2.0.6.13 tracks/erlang/exercises/triangle/example.erl
trackler-2.0.6.12 tracks/erlang/exercises/triangle/example.erl
trackler-2.0.6.11 tracks/erlang/exercises/triangle/example.erl
trackler-2.0.6.10 tracks/erlang/exercises/triangle/example.erl
trackler-2.0.6.9 tracks/erlang/exercises/triangle/example.erl