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.78 tracks/julia/exercises/triangle/example.jl
trackler-2.2.1.77 tracks/julia/exercises/triangle/example.jl
trackler-2.2.1.76 tracks/julia/exercises/triangle/example.jl
trackler-2.2.1.75 tracks/julia/exercises/triangle/example.jl
trackler-2.2.1.74 tracks/julia/exercises/triangle/example.jl
trackler-2.2.1.73 tracks/julia/exercises/triangle/example.jl
trackler-2.2.1.72 tracks/julia/exercises/triangle/example.jl
trackler-2.2.1.71 tracks/julia/exercises/triangle/example.jl
trackler-2.2.1.70 tracks/julia/exercises/triangle/example.jl
trackler-2.2.1.69 tracks/julia/exercises/triangle/example.jl
trackler-2.2.1.68 tracks/julia/exercises/triangle/example.jl
trackler-2.2.1.67 tracks/julia/exercises/triangle/example.jl
trackler-2.2.1.66 tracks/julia/exercises/triangle/example.jl
trackler-2.2.1.65 tracks/julia/exercises/triangle/example.jl
trackler-2.2.1.64 tracks/julia/exercises/triangle/example.jl
trackler-2.2.1.63 tracks/julia/exercises/triangle/example.jl
trackler-2.2.1.62 tracks/julia/exercises/triangle/example.jl
trackler-2.2.1.61 tracks/julia/exercises/triangle/example.jl
trackler-2.2.1.60 tracks/julia/exercises/triangle/example.jl
trackler-2.2.1.59 tracks/julia/exercises/triangle/example.jl