Sha256: 2a5b0985ed6111a1a4aed7e892c0dcd1f0f8a9146a49f0eea6973c37cd386504

Contents?: true

Size: 182 Bytes

Versions: 311

Compression:

Stored size: 182 Bytes

Contents

function trinary_to_decimal(str::AbstractString)
    typeof(match(r"^[0-2]+$", str)) == Void && return 0
    mapreduce(i->(i[2]-'0')*3^i[1], +, zip(0:length(str), reverse(str)))
end

Version data entries

311 entries across 311 versions & 1 rubygems

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