Data update
This commit is contained in:
parent
0df55f9f24
commit
aec8ed51b6
1045 changed files with 18889 additions and 2777 deletions
|
|
@ -1,6 +1,6 @@
|
|||
F cusip_check(=cusip)
|
||||
I cusip.len != 9
|
||||
X ValueError(‘CUSIP must be 9 characters’)
|
||||
X.throw ValueError(‘CUSIP must be 9 characters’)
|
||||
|
||||
cusip = cusip.uppercase()
|
||||
V total = 0
|
||||
|
|
|
|||
|
|
@ -1,22 +1,22 @@
|
|||
val .isCusip = f(.s) {
|
||||
if not isString(.s) or len(.s) != 9 {
|
||||
val .isCusip = fn(.s) {
|
||||
if .s is not string or len(.s) != 9 {
|
||||
return false
|
||||
}
|
||||
|
||||
val .basechars = cp2s('0'..'9') ~ cp2s('A'..'Z') ~ "*@#"
|
||||
val .basechars = '0'..'9' ~ 'A'..'Z' ~ "*@#"
|
||||
|
||||
val .sum = for[=0] .i of 8 {
|
||||
var .v = index(s2s(.s, .i), .basechars)
|
||||
if not .v: return false
|
||||
.v = .v[1]-1
|
||||
if .i div 2: .v x= 2
|
||||
if .i div 2: .v *= 2
|
||||
_for += .v \ 10 + .v rem 10
|
||||
}
|
||||
|
||||
.s[9]-'0' == (10-(.sum rem 10)) rem 10
|
||||
}
|
||||
|
||||
val .candidates = w/037833100 17275R102 38259P508 594918104 68389X106 68389X105/
|
||||
val .candidates = fw/037833100 17275R102 38259P508 594918104 68389X106 68389X105/
|
||||
|
||||
for .c in .candidates {
|
||||
writeln .c, ": ", if(.isCusip(.c): "good" ; "bad")
|
||||
|
|
|
|||
|
|
@ -1,5 +1,5 @@
|
|||
val .isCusip = f(.s) {
|
||||
if not isString(.s) or len(.s) != 9 {
|
||||
val .isCusip = fn(.s) {
|
||||
if .s is not string or len(.s) != 9 {
|
||||
return false
|
||||
}
|
||||
|
||||
|
|
@ -21,7 +21,7 @@ val .isCusip = f(.s) {
|
|||
default: return false
|
||||
}
|
||||
|
||||
if .i div 2: .v x= 2
|
||||
if .i div 2: .v *= 2
|
||||
_for += .v \ 10 + .v rem 10
|
||||
}
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue