ISBN13 check digit: Difference between revisions
Content deleted Content added
Langurmonkey (talk | contribs) →{{header|langur}}: added langur 0.7.1 example |
Langurmonkey (talk | contribs) |
||
Line 188: | Line 188: | ||
=={{header|langur}}== |
=={{header|langur}}== |
||
{{works with|langur|0.7.1}} |
{{works with|langur|0.7.1}} |
||
<lang langur>val .isbn13checkdigit = f(. |
<lang langur>val .isbn13checkdigit = f(var .s) { |
||
matching(re/^[0-9]{13}$/, .s = replace(.s, RE/[\- ]/)) and |
|||
matching(re/^[0-9]{13}$/, .s) and |
|||
fold(f{+}, map([_, f .d x 3], map(f .c-'0', s2cp .s))) rem 10 == 0 |
fold(f{+}, map([_, f .d x 3], map(f .c-'0', s2cp .s))) rem 10 == 0 |
||
} |
} |