That - is a bit plump: acs3 =. (, 10 | 9 7 9 3 7 1 +/@:* ])&.(sn i. |:)
Henry Rich > -----Original Message----- > From: [EMAIL PROTECTED] > [mailto:[EMAIL PROTECTED] On Behalf Of Dan Bron > Sent: Friday, August 01, 2008 11:48 PM > To: 'Programming forum' > Subject: RE: [Jprogramming] Check digit utility > > I wrote: > > sn =. '0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZ' > NB. SEDOL numerals > > acs0 =. (,. 10 | 10 - 10 | 1 3 1 7 3 9 +/@:*"1 > ])&.(sn&i.) NB. Append checksum > > Then refined (thanks to Raul): > > acs1 =. (, 10 | 0 - 1 3 1 7 3 9 +/@:* ])&.(sn i. |:) > > One more refinement: > > acs2 =. (, 10 | 1 3 1 7 3 9 +/@:* -)&.(sn i. |:) > > Though this version is a bit slower than the previous acs1 > I prefer it. There is no fat left to cut. > > -Dan > > ---------------------------------------------------------------------- > For information about J forums see > http://www.jsoftware.com/forums.htm ---------------------------------------------------------------------- For information about J forums see http://www.jsoftware.com/forums.htm
