ISBN13 check digit: Difference between revisions
Content added Content deleted
Langurmonkey (talk | contribs) |
Langurmonkey (talk | contribs) |
||
Line 188: | Line 188: | ||
=={{header|langur}}== |
=={{header|langur}}== |
||
{{works with|langur|0.8. |
{{works with|langur|0.8.11}} |
||
In this example, we map to multiple functions (actually 1 no-op). |
In this example, we map to multiple functions (actually 1 no-op). |
||
<lang langur>val .isbn13checkdigit = f(var .s) { |
<lang langur>val .isbn13checkdigit = f(var .s) { |
||
.s = replace(.s, RE/[\- ]/) |
.s = replace(.s, RE/[\- ]/) |
||
matching(re/^[0-9]{13}$/, .s) and |
matching(re/^[0-9]{13}$/, .s) and |
||
fold(f{+}, map [_, f |
fold(f{+}, map [_, f{x 3}], s2n .s) div 10 |
||
} |
} |
||