<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
<head>
<!--
[
(define title "SEDOL Validator")

(define (just-digits list1)
  (cond ((null? list1) '())
	((char-numeric? (car list1))
	 (cons (car list1) (just-digits (cdr list1))))
	(else (just-digits (cdr list1)))))

(define (string->digits str)
  (if (string? str)
      (list->string (just-digits (string->list str)))
      ""))

(define-input (string->digits sedol))

(define (sedol-addend ch weight)
  (* (string->number (string ch)) weight))
     
(define (sedol-valid? str)
  (and (= 7 (string-length str))
       (zero? (remainder (apply + (map sedol-addend
				       (string->list str)
				       '(1 3 1 7 3 9 1)))
			 10))))

(define (sedol-digit7 str6)
  (modulo (- (apply + (map sedol-addend
			   (string->list str6)
			   '(1 3 1 7 3 9))))
	  10))
]
-->
<title>[title]</title>
<link rel=stylesheet type="text/css" href="[brlcab-top]brl.css">
</head>

<body>

[brlcab-mascot]

<h1>[title]</h1>

[(brl-when (brl-nonblank? sedol)]
<strong>[sedol] is[(brl-unless (sedol-valid? sedol)] not[)] a valid SEDOL.</strong>
[)]

[(brl-when (= 6 (string-length sedol))]
<strong>However, [sedol (sedol-digit7 sedol)] is.</strong>
[)]

<p>SEDOL numbers are
<a href="http://www.prices.londonstockexchange.com/glossary.asp">defined</a>
by the London Stock Exchange as seven-digit numbers, the last of which
is a check digit.</p>

<form method="POST">
Enter a number:
<input type=text name=sedol>
<input type=submit value="Validate">
</form>

<hr>
<p>
   <a href="[(brl-source-link brl-context)]">View Source</a></p>
</body>
</html>