ISBN13 check digit: Difference between revisions
Content added Content deleted
m (→{{header|Factor}}: mod zero? -> divisor?) |
|||
Line 95: | Line 95: | ||
=={{header|Factor}}== |
=={{header|Factor}}== |
||
<lang factor>USING: combinators.short-circuit formatting kernel math |
<lang factor>USING: combinators.short-circuit formatting kernel math |
||
math.parser math.vectors qw sequences |
math.functions math.parser math.vectors qw sequences |
||
unicode ; |
sequences.extras sets unicode ; |
||
: (isbn13?) ( str -- ? ) |
: (isbn13?) ( str -- ? ) |
||
string>digits |
string>digits |
||
[ <evens> sum ] [ <odds> 3 v*n sum + ] bi 10 |
[ <evens> sum ] [ <odds> 3 v*n sum + ] bi 10 divisor? ; |
||
: isbn13? ( str -- ? ) |
: isbn13? ( str -- ? ) |