Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- (define (countInList ct listInput element)
- (cond
- ( (NULL? (car listInput));if it is null...
- ct ;return count?
- )
- ( (eq? (car listInput) element); if the first element is equal to the element provided...
- (countInList (+ ct 1) (cdr listInput) element);recursive call and increment ct by 1.
- )
- (else
- (countInList ct (cdr listInput) element);otherwise, call again without increasing count.
- )
- )
- )
Add Comment
Please, Sign In to add comment