(define tally (lambda (val lst) (cond ((null? lst) 0) ((eq? val (car lst)) (+ 1 (tally val (cdr lst)))) (else (tally val (cdr lst))))))