Data commit
This commit is contained in:
parent
7387c8f97b
commit
cb5bb5e222
199093 changed files with 3378972 additions and 0 deletions
12
Task/SEDOLs/Common-Lisp/sedols.lisp
Normal file
12
Task/SEDOLs/Common-Lisp/sedols.lisp
Normal file
|
|
@ -0,0 +1,12 @@
|
|||
(defun append-sedol-check-digit (sedol &key (start 0) (end (+ start 6)))
|
||||
(assert (<= 0 start end (length sedol)))
|
||||
(assert (= (- end start) 6))
|
||||
(loop
|
||||
:with checksum = 0
|
||||
:for weight :in '(1 3 1 7 3 9)
|
||||
:for index :upfrom start
|
||||
:do (incf checksum (* weight (digit-char-p (char sedol index) 36)))
|
||||
:finally (let* ((posn (- 10 (mod checksum 10)))
|
||||
(head (subseq sedol start end))
|
||||
(tail (digit-char posn)))
|
||||
(return (concatenate 'string head (list tail))))))
|
||||
Loading…
Add table
Add a link
Reference in a new issue