ISBN13 check digit: Difference between revisions

Content deleted Content added
Langurmonkey (talk | contribs)
Langurmonkey (talk | contribs)
→‎{{header|langur}}: using operator implied function
Line 187: Line 187:


=={{header|langur}}==
=={{header|langur}}==
{{works with|langur|0.6.6}}
<lang langur>val .isbn13checkdigit = f(.n) {
<lang langur>val .isbn13checkdigit = f(.n) {
val .s = replace(.n, RE/[\- ]/, ZLS)
val .s = replace(.n, RE/[\- ]/, ZLS)
Line 198: Line 199:
map f .c-'0', s2cp .s,
map f .c-'0', s2cp .s,
)
)
fold(f .x + .y, .nums) rem 10 == 0
fold(f{+}, .nums) rem 10 == 0
}
}