Alright, now that we've got SEDOLs down, let's bring the problem across the
pond.
A CUSIP is the North American analog of the SEDOL. Its format is described at
[1]. Provide a verb which, given the first 8 digits of a CUSIP, produces the
check digit. The usual metrics apply: novelty, brevity, velocity, and
parsimony.
To get you started, here's an rough first draft:
cn =. '0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZ'
ccd =: (10 | 10 - [: +/@:, 10 #.^:_1 ] * 1 + 2 | [EMAIL
PROTECTED])&.(cn&i.) NB. CUSIP check digit
ccd }: '931142103'
3
({: -: ccd@:}:) '931142103'
1
-Dan
[1] http://en.wikipedia.org/wiki/CUSIP
----------------------------------------------------------------------
For information about J forums see http://www.jsoftware.com/forums.htm