;; The first three lines of this file were inserted by DrRacket. They record metadata ;; about the language level of this file in a form that our tools can easily process. #reader(lib "htdp-intermediate-lambda-reader.ss" "lang")((modname numberCount) (read-case-sensitive #t) (teachpacks ((lib "docs.rkt" "teachpack" "htdp"))) (htdp-settings #(#t constructor repeating-decimal #f #t none #f ((lib "docs.rkt" "teachpack" "htdp")) #f))) ; note that this is a deep recursive function (define (numberCount x) (cond ((null? x) 0) ((atom? x) (cond ((number? x) 1) (else 0))) (else (+ (numberCount (car x)) (numberCount (cdr x)))) )) (numberCount '((1) 2 200 (100 5))) (numberCount '((1) 2 sam (larry 5))) (numberCount '(((1)) (2 (3)) sam (larry) (jill ((5)))))