SEDOLs: Difference between revisions

166 bytes removed ,  3 years ago
m
Line 1,199:
{{Works with|Office 365 Betas 2021}}
 
<lang lisp>SEDOLCHECKSUM=LAMBDA(s,
IF(6 = LEN(s),
=LAMBDA(s,
LET(
lng cs, LENMID(s, SEQUENCE(1, 6, 1, 1), 1),
IF(6 = lng isVowel, LAMBDA(c,
LET ELEM(c)({"A","E","I","O","U"})
cs, MID(s, SEQUENCE(1, 6, 1, 1), 1),
isVowelsedolValue, LAMBDA(c,
ELEMLET(c)({"A","E","I","O","U"})
ic, CODE(c),
sedolValue, LAMBDA IF(c65 > ic,
LET( ic - 48,
(ic, CODE(c+ 10), - 65
IF(65 > ic,
ic - 48,
(ic + 10) - 65
)
)
),
IF(OR(isVowel(cs)),
" -> Invalid vowel in SEDOL string",
MOD(
10 - MOD(
SUM(
MUL({1,3,1,7,3,9})(
sedolValue(cs)
)
), 10
), 10
)
)
),
"Expected a 6-character SEDOL"IF(OR(isVowel(cs)),
" -> Invalid vowel in SEDOL string",
)
),MOD(
10 - MOD(
ic - 48,SUM(
10 - MOD MUL({1,3,1,7,3,9})(
IF(OR(isVowel sedolValue(cs)),
IF(65 > ic, )
(ic +), 10) - 65
), )10
)
), 10
),
"Expected a 6-character SEDOL"
)
)</lang>
9,655

edits