Data update

This commit is contained in:
Ingy döt Net 2025-08-11 18:05:26 -07:00
parent 4d5544505c
commit 4924dd0264
3073 changed files with 55820 additions and 4408 deletions

View file

@ -0,0 +1,40 @@
:- set_prolog_flag(double_quotes, codes).
:- use_module(library(clpfd)).
sedol -->
sdigit(S1), sdigit(S2), sdigit(S3), sdigit(S4), sdigit(S5), sdigit(S6), sdigit(S7),
{ S7 in 0..9,
(S1 + S2 * 3 + S3 + S4 * 7 + S5 * 3 + S6 * 9 + S7) mod 10 #= 0
}.
sdigit(Value) --> [Code],
{ Value in 0..35,
Code in 48..57\/66..68\/70..72\/74..78\/80..84\/86..90,
Code in 48..57 #<==> Value #= Code - 48,
Code in 66..90 #<==> Value #= Code - 55
}.
add_checksum_digit(SEDOL6, SEDOL7) :-
append(SEDOL6, [_], SEDOL7),
phrase(sedol, SEDOL7),
once(label(SEDOL7)).
% adds the checksum digits to each number and removes any invalid numbers
task(SEDOL6s) :-
convlist(add_checksum_digit, SEDOL6s, SEDOL7s),
foreach(member(SEDOL7, SEDOL7s), format("~s~n", [SEDOL7])).
?- task([
"710889",
"B0YBKJ",
"406566",
"B0YBLH",
"228276",
"B0YBKL",
"557910",
"B0YBKR",
"585284",
"B0YBKT",
"BOYBKT", % Ill formed test case - illegal vowel.
"B00030"
]).

View file

@ -0,0 +1,5 @@
?- SEDOL = [0'7, _, 0'0, 0'8, 0'8, 0'9, 0'9], phrase(sedol, SEDOL), label(SEDOL).
SEDOL = "7108899" ;
SEDOL = "7B08899" ;
SEDOL = "7L08899" ;
SEDOL = "7V08899".

View file

@ -0,0 +1,21 @@
?- phrase(sedol, SEDOL), label(SEDOL).
SEDOL = "0000000" ;
SEDOL = "0000011" ;
SEDOL = "0000022" ;
SEDOL = "0000033" ;
SEDOL = "0000044" ;
SEDOL = "0000055" ;
SEDOL = "0000066" ;
SEDOL = "0000077" ;
SEDOL = "0000088" ;
SEDOL = "0000099" ;
SEDOL = "00000B1" ;
SEDOL = "00000C2" ;
SEDOL = "00000D3" ;
SEDOL = "00000F5" ;
SEDOL = "00000G6" ;
SEDOL = "00000H7" ;
SEDOL = "00000J9" ;
SEDOL = "00000K0" ;
SEDOL = "00000L1" ;
SEDOL = "00000M2" . % etc...