ISBN13 check digit: Difference between revisions

Content added Content deleted
(for clarity, replaced ISBN for opCode with ISBN for Python Interviews (which I have no vested interest in))
Line 1,945: Line 1,945:
<syntaxhighlight lang="langur">val .isbn13checkdigit = f(var .s) {
<syntaxhighlight lang="langur">val .isbn13checkdigit = f(var .s) {
.s = replace(.s, RE/[\- ]/)
.s = replace(.s, RE/[\- ]/)
matching(re/^[0-9]{13}$/, .s) and
.s -> re/^[0-9]{13}$/ and
fold(f{+}, map [_, f{x 3}], s2n .s) div 10
fold(f{+}, map [_, f{x 3}], s2n .s) div 10
}
}