Handbook
Glossary
luhn-digit ( n -- n )
Vocabulary
rosetta-code.luhn-test
Inputs
n
an
object
Outputs
n
an
object
Definition
USING:
kernel
math
sequences
;
IN:
rosetta-code.luhn-test
:
luhn-digit
( n -- n )
reversed-digits
dup
length
<iota>
[
2dup
swap
nth
swap
odd?
[
2
*
10
/mod
+
]
when
]
map
sum
10
mod
nip
;