ISBN13 check digit: Difference between revisions
Content added Content deleted
Langurmonkey (talk | contribs) (for clarity, replaced ISBN for opCode with ISBN for Python Interviews (which I have no vested interest in)) |
Langurmonkey (talk | contribs) |
||
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/[\- ]/) |
||
.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 |
||
} |
} |