Sha256: b93400b5d4dfd5a7603bb59dff32206cb7f9373ce015670a97fec8b73b360699

Contents?: true

Size: 692 Bytes

Versions: 125

Compression:

Stored size: 692 Bytes

Contents

# This problem gives practice on reusing procedures by extracting them as functions.

function is_equilateral(sides)
    sides = sort(sides)
    return verify_triangle(sides) && verify_equilateral(sides)
end

function is_isosceles(sides)
    sides = sort(sides)
    return verify_triangle(sides) && verify_isosceles(sides)
end

function is_scalene(sides)
    sides = sort(sides)
    return verify_triangle(sides) && verify_scalene(sides)
end


verify_equilateral(sorted) = (sorted[1] == sorted[3])

verify_isosceles(sorted) = (sorted[1] == sorted[2] || sorted[2] == sorted[3])

verify_scalene(sorted) = !verify_isosceles(sorted)

verify_triangle(sorted) = (sorted[3] < sorted[1] + sorted[2])

Version data entries

125 entries across 125 versions & 1 rubygems

Version Path
trackler-2.2.1.119 tracks/julia/exercises/triangle/example.jl
trackler-2.2.1.118 tracks/julia/exercises/triangle/example.jl
trackler-2.2.1.117 tracks/julia/exercises/triangle/example.jl
trackler-2.2.1.116 tracks/julia/exercises/triangle/example.jl
trackler-2.2.1.115 tracks/julia/exercises/triangle/example.jl
trackler-2.2.1.114 tracks/julia/exercises/triangle/example.jl
trackler-2.2.1.113 tracks/julia/exercises/triangle/example.jl
trackler-2.2.1.111 tracks/julia/exercises/triangle/example.jl
trackler-2.2.1.110 tracks/julia/exercises/triangle/example.jl
trackler-2.2.1.109 tracks/julia/exercises/triangle/example.jl
trackler-2.2.1.108 tracks/julia/exercises/triangle/example.jl
trackler-2.2.1.107 tracks/julia/exercises/triangle/example.jl
trackler-2.2.1.106 tracks/julia/exercises/triangle/example.jl
trackler-2.2.1.105 tracks/julia/exercises/triangle/example.jl
trackler-2.2.1.104 tracks/julia/exercises/triangle/example.jl
trackler-2.2.1.103 tracks/julia/exercises/triangle/example.jl
trackler-2.2.1.102 tracks/julia/exercises/triangle/example.jl
trackler-2.2.1.101 tracks/julia/exercises/triangle/example.jl
trackler-2.2.1.100 tracks/julia/exercises/triangle/example.jl
trackler-2.2.1.99 tracks/julia/exercises/triangle/example.jl