SEDOLs: Difference between revisions

Content added Content deleted
Line 1,199: Line 1,199:
{{Works with|Office 365 Betas 2021}}
{{Works with|Office 365 Betas 2021}}


<lang lisp>SEDOLCHECKSUM
<lang lisp>=LAMBDA(s,
IF(6 = LEN(s),
=LAMBDA(s,
LET(
LET(
lng, LEN(s),
cs, MID(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),
),
isVowel, LAMBDA(c,
sedolValue, LAMBDA(c,
ELEM(c)({"A","E","I","O","U"})
LET(
),
ic, CODE(c),
sedolValue, LAMBDA(c,
IF(65 > ic,
LET(
ic - 48,
ic, CODE(c),
(ic + 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(
SUM(
MUL({1,3,1,7,3,9})(
sedolValue(cs)
)
), 10
), 10
)
)
),
"Expected a 6-character SEDOL"
)
)
)</lang>
)</lang>