(define (foldl proc init lst) (let loop ((lst lst) (r init)) (if (null? lst) r (loop (cdr lst) (proc r (car lst)))))) (define (numeric-value str) (let ((l (string->list str)) (t '((#\C 100) (#\D 500) (#\I 1) (#\L 50) (#\M 1000) (#\U 5) (#\V 5)))) (foldl (lambda (s x) (let ((r (assoc x t))) (if r (+ (cadr r) s) s))) 0 (map char-upcase l)))) (define (go) (display (numeric-value "vicarius filii dei")) (newline) 0)) (go)