Guest User

Untitled

a guest
Dec 16th, 2017
102
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.41 KB | None | 0 0
  1. (define (countInList ct listInput element)
  2.  
  3. (cond
  4. ( (NULL? (car listInput));if it is null...
  5. ct ;return count?
  6. )
  7. ( (eq? (car listInput) element); if the first element is equal to the element provided...
  8. (countInList (+ ct 1) (cdr listInput) element);recursive call and increment ct by 1.
  9. )
  10. (else
  11. (countInList ct (cdr listInput) element);otherwise, call again without increasing count.
  12. )
  13. )
  14. )
Add Comment
Please, Sign In to add comment