SEDOLs: Difference between revisions

RPL: add section
m (→‎{{header|Perl}}: future-proof for 5.36, explicit :prototype)
(RPL: add section)
Line 3,598:
B0YBKT7
B000300
</pre>
 
=={{header|RPL}}==
{{works with|Halcyon Calc|4.2.7}}
{| class="wikitable"
! RPL code
! Comment
|-
|
{ 1 3 1 7 3 9 } → weights
≪ 0 1 6 '''FOR''' j
OVER j DUP SUB NUM
'''IF''' DUP 65 ≥ '''THEN''' 7 - '''END''' 48 -
weights j GET * +
'''NEXT'''
10 SWAP OVER MOD - 10 MOD →STR +
≫ ≫ ''''→7DOL'''' STO
|
'''→7DOL''' ''( "SEDOL6" -- "SEDOL7" ) ''
store weights
sum=0 ; for j = 1 to 6
get jth character of SEDOL
convert it to its index
sum += index * weight
check = mod(10-mod(sum,10),10)
.
|}
{{in}}
<pre>
≪ { }
{ "710889" "B0YBKJ" "406566" "B0YBLH" "228276" "B0YBKL" "557910" "B0YBKR" "585284" "B0YBKT" "B00030" }
1 OVER SIZE FOR j DUP j GET →7DOL SWAP + SWAP NEXT DROP
≫ EVAL
</pre>
{{out}}
<pre>
1: { "7108899" "B0YBKJ7" "4065663" "B0YBLH2" "2282765" "B0YBKL9" "5579107" "B0YBKR5" "5852842" "B0YBKT7" "B000300" }
</pre>
 
1,150

edits