CUSIP: Difference between revisions
Content added Content deleted
m (Cusip function was incorrect in several Languages. '0' -> 0, '9' -> 9, 'A' => 10, 'Z' -> 35, '*' -> 36 etc. The integer value for A-Z was off by 10.) |
m (Updated the previously incorrect output and added two cases that highlight the correct algo now.) |
||
Line 1,069: | Line 1,069: | ||
"show some nice output for the Rosetta Wiki" |
"show some nice output for the Rosetta Wiki" |
||
[] |
[] |
||
(doseq [cusip ["037833100" "17275R102" "38259P508" "594918104" "68389X106" "68389X105" |
(doseq [cusip ["037833100" "17275R102" "38259P508" "594918104" "68389X106" "68389X105" "EXTRACRD8" |
||
" |
"EXTRACRD9" "BADCUSIP!" "683&9X106" "68389x105" "683$9X106" "68389}105" "87264ABE4"]] |
||
(println cusip (if (is-valid-cusip9? cusip) "valid" "invalid")))) |
(println cusip (if (is-valid-cusip9? cusip) "valid" "invalid")))) |
||
</lang> |
</lang> |
||
Line 1,083: | Line 1,083: | ||
68389X106 invalid |
68389X106 invalid |
||
68389X105 valid |
68389X105 valid |
||
EXTRACRD8 |
EXTRACRD8 invalid |
||
EXTRACRD9 valid |
|||
BADCUSIP! invalid |
BADCUSIP! invalid |
||
683&9X106 invalid |
683&9X106 invalid |
||
Line 1,089: | Line 1,090: | ||
683$9X106 invalid |
683$9X106 invalid |
||
68389}105 invalid |
68389}105 invalid |
||
87264ABE4 valid |
|||
</pre> |
</pre> |
||