UPC: Difference between revisions

Content added Content deleted
(promoted to (full) task status.)
m (→‎{{header|Factor}}: mod zero? -> divisor?)
Line 1,034: Line 1,034:
{{works with|Factor|0.99 2019-10-06}}
{{works with|Factor|0.99 2019-10-06}}
<lang factor>USING: combinators combinators.short-circuit formatting grouping
<lang factor>USING: combinators combinators.short-circuit formatting grouping
kernel locals math math.vectors sequences sequences.repeating
kernel locals math math.functions math.vectors sequences
unicode ;
sequences.repeating unicode ;


CONSTANT: numbers {
CONSTANT: numbers {
Line 1,057: Line 1,057:


: valid-checksum? ( seq -- ? )
: valid-checksum? ( seq -- ? )
{ 3 1 } 12 cycle v* sum 10 mod zero? ;
{ 3 1 } 12 cycle v* sum 10 divisor? ;


: valid-upc? ( seq -- ? )
: valid-upc? ( seq -- ? )