UPC: Difference between revisions
m
→{{header|Julia}}
(julia example) |
|||
Line 266:
mats, dig, dsum = filter(!isempty, m.captures), Int[], 0
for mat in mats
append!(dig, [ptod1[x.match] for x in eachmatch(r"(.......)", mat)
if haskey(ptod1, x.match)])
append!(dig, [ptod2[x.match] for x in eachmatch(r"(.......)", mat)
if haskey(ptod2, x.match)])
end
dsum += sum([(isodd(i) ? 3 : 1) * n for (i, n) in enumerate(dig)])
end
return ""
end
Line 310 ⟶ 308:
653483540435
</pre>
=={{header|Perl}}==
|