CUSIP: Difference between revisions

m
Updated the previously incorrect output and added two cases that highlight the correct algo now.
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:
"show some nice output for the Rosetta Wiki"
[]
(doseq [cusip ["037833100" "17275R102" "38259P508" "594918104" "68389X106" "68389X105" "EXTRACRD8"
"EXTRACRD8EXTRACRD9" "BADCUSIP!" "683&9X106" "68389x105" "683$9X106" "68389}105" "87264ABE4"]]
(println cusip (if (is-valid-cusip9? cusip) "valid" "invalid"))))
</lang>
Line 1,083:
68389X106 invalid
68389X105 valid
EXTRACRD8 validinvalid
EXTRACRD9 valid
BADCUSIP! invalid
683&9X106 invalid
Line 1,089 ⟶ 1,090:
683$9X106 invalid
68389}105 invalid
87264ABE4 valid
</pre>
 
Anonymous user