(define (string-lengths some-list #!optional (lengths '())) ; some-list - the list of strings. ; lengths - the length of the strings we've calc'd so far : initially '(). (if (null? somelist) (begin ; "base case" - we're at the end of some-list. (display "Got empty list: ending") (newline) (reverse lengths)) (begin ; take the first element in the list and work out the length. (display (string-length (car some-list))) (newline) (string-lengths ; pass on the rest of the list and the list of lengths. (cdr some-list) ; the tail of some-list (cons - place the string-length of list list at the head of the list of lengths. (string-length (car some-list)) lengths)))))