; File: depth.scm ; Author: Mihaela Malita ; Title: The depth of a list ; (depth '(a (b (c )) d) ) -> 3 ; (depth '(a b c)) -> 1 ; (depth '((a 1) (b 5))) -> 2 ; (depth '((a 1) (b 5) (c 9))) -> 2 ; (depth '(((((a)))))) -> 5 ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; (define (depth L) (cond ((not (pair? L)) 0) (#t (max (+ 1 (depth (car L))) (depth (cdr L)))) ))