How to resolve the algorithm SEDOLs step by step in the M4 programming language
Published on 12 May 2024 09:40 PM
How to resolve the algorithm SEDOLs step by step in the M4 programming language
Table of Contents
Problem Statement
For each number list of 6-digit SEDOLs, calculate and append the checksum digit.
That is, given this input: Produce this output: Check each input is correctly formed, especially with respect to valid characters allowed in a SEDOL string.
Let's start with the solution:
Step by Step solution about How to resolve the algorithm SEDOLs step by step in the M4 programming language
Source code in the m4 programming language
divert(-1)
changequote(`[',`]')
define([_bar],include(sedol.inp))
define([eachlineA],
[ifelse(eval($2>0),1,
[$3(substr([$1],0,$2))[]eachline(substr([$1],incr($2)),[$3])])])
define([eachline],[eachlineA([$1],index($1,[
]),[$2])])
define([_idx],
[index([0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZ],substr($1,$2,1))])
define([_wsum],
[eval(_idx($1,0)+_idx($1,1)*3+_idx($1,2)+_idx($1,3)*7+_idx($1,4)*3+_idx($1,5)*9)])
define([checksum],
[$1[]eval((10-_wsum($1)%10)%10)
])
divert
eachline(_bar,[checksum])
You may also check:How to resolve the algorithm Jewels and stones step by step in the Delphi programming language
You may also check:How to resolve the algorithm Iterated digits squaring step by step in the PicoLisp programming language
You may also check:How to resolve the algorithm Sierpinski pentagon step by step in the Rust programming language
You may also check:How to resolve the algorithm SEDOLs step by step in the JavaScript programming language
You may also check:How to resolve the algorithm Vector products step by step in the RPL programming language