RosettaCodeData/Task/SEDOLs/Oforth/sedols.oforth
2016-12-05 23:44:36 +01:00

5 lines
184 B
Text

func: sedol(s)
[ 1, 3, 1, 7, 3, 9 ] s
zipWith(#[ dup isDigit ifTrue: [ '0' - ] else: [ 'A' - 10 + ] * ]) sum
10 mod 10 swap - 10 mod
StringBuffer new s << swap '0' + <<c ;