SEDOLs: Difference between revisions
m
→{{header|langur}}
(→{{header|Kotlin}}: Make Kotlin solution more succinct using modern library features) |
Langurmonkey (talk | contribs) |
||
(3 intermediate revisions by 2 users not shown) | |||
Line 2,373:
fun sedol7(sedol6: String): String {
require(sedol6.all { it in
▲ throw IllegalArgumentException("Argument string contains an invalid character")
val sum = sedol6.map { it.digitToInt(36) }.zip(weights, Int::times).sum()
Line 2,410 ⟶ 2,408:
=={{header|langur}}==
{{trans|Go}}
<syntaxhighlight lang="langur">val .csd =
switch len(.code) {
case 0:
Line 2,426 ⟶ 2,424:
val .nums = s2n .code
val .sum = for[=0] .i of .nums {
_for += .nums[.i]
}
Line 2,432 ⟶ 2,430:
}
val .h =
# invalid...
"": 0,
Line 3,206 ⟶ 3,204:
sedol, sedolweight)
)
return str((
for sedol in '''
Line 3,250 ⟶ 3,248:
Right(0)
)
)(lambda d: Right(str((
|