SEDOLs: Difference between revisions
Content added Content deleted
(Updated for Nim 1.4: added missing parameter types. Done several other changes/improvements. Added output.) |
|||
Line 2,449: | Line 2,449: | ||
=={{header|Nim}}== |
=={{header|Nim}}== |
||
<lang nim> |
<lang nim>proc c2v(c: char): int = |
||
proc c2v(c): int = |
|||
assert c notin "AEIOU" |
assert c notin "AEIOU" |
||
if c < 'A': ord(c) - ord('0') else: ord(c) - ord('7') |
|||
let a = ord(c) |
|||
if a < 65: a - 48 |
|||
⚫ | |||
else: a - 55 |
|||
⚫ | |||
⚫ | |||
⚫ | |||
⚫ | |||
⚫ | |||
⚫ | |||
⚫ | |||
⚫ | |||
⚫ | |||
⚫ | |||
for sedol in ["710889", "B0YBKJ", "406566", "B0YBLH", |
|||
⚫ | |||
"228276", "B0YBKL", "557910", "B0YBKR", |
|||
"585284", "B0YBKT", "B00030"]: |
|||
⚫ | |||
{{out}} |
|||
for sedol in """710889 |
|||
<pre>710889 → 7108899 |
|||
B0YBKJ |
|||
B0YBKJ → B0YBKJ7 |
|||
406566 |
|||
406566 → 4065663 |
|||
B0YBLH |
|||
B0YBLH → B0YBLH2 |
|||
228276 |
|||
228276 → 2282765 |
|||
B0YBKL |
|||
B0YBKL → B0YBKL9 |
|||
557910 |
|||
557910 → 5579107 |
|||
B0YBKR |
|||
B0YBKR → B0YBKR5 |
|||
585284 |
|||
585284 → 5852842 |
|||
B0YBKT |
|||
B0YBKT → B0YBKT7 |
|||
B00030""".splitLines(): |
|||
B00030 → B000300</pre> |
|||
⚫ | |||
=={{header|OCaml}}== |
=={{header|OCaml}}== |