Data update
This commit is contained in:
parent
4924dd0264
commit
cb74b7914d
10 changed files with 60 additions and 11 deletions
|
|
@ -0,0 +1,18 @@
|
|||
!YS-v0
|
||||
|
||||
defn main(*nums):
|
||||
each isin nums:
|
||||
say: "$isin - $if(isin:isin? 'valid' 'invalid')"
|
||||
|
||||
defn isin?(isin):
|
||||
isin.re-matches(/[A-Z]{2}[A-Z0-9]{9}[0-9]/) &&
|
||||
isin.map(b36-10).apply(str):luhn?
|
||||
|
||||
defn b36-10(c):
|
||||
c =: c:I - 48
|
||||
if c > 9: (c - 7) c
|
||||
|
||||
defn luhn?(cc):
|
||||
map(mul cc:digits:reverse [1 2]:cycle)
|
||||
.map(\(I(_ / 10) + (_ % 10))):sum
|
||||
.mod(10):zero?
|
||||
Loading…
Add table
Add a link
Reference in a new issue