[Jprogramming] Check digit utility

Raul Miller rauldmiller at gmail.com
Sat Aug 2 08:04:27 HKT 2008


On Fri, Aug 1, 2008 at 6:39 PM, Dan Bron <j at bron.us> wrote:
>        sn   =.  '0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZ'              NB.  SEDOL numerals
>        acs  =.  (,. 10 | 10 - 10 | 1 3 1 7 3 9 +/@:*"1 ])&.(sn&i.)  NB.  Append checksum
> Though the repeated appearance of  10  makes me suspect there's a cuter (more concise) way to express this.

   (10&|@- -: 10 | 10 - 10 | ]) i: 100
1

Presumably they used the more round about expression to avoid
problems with languages that have confused implementations of
modulo of negative numbers.

-- 
Raul


More information about the Programming mailing list