Question: Racket Language: Write a recursive Racket function to do the following: Count how many times an item (atom) appears on a list. The function should
Racket Language:
Write a recursive Racket function to do the following:
Count how many times an item (atom) appears on a list.
The function should work on all types of lists (not just simple lists of atoms).
Test cases:
(count 3 '( 1 5 6 7 8 3 2 3 )) //returns 2
(count dog '( cat bird cat dog frog )) //returns 1
(count a '( a ( a b ) ( c ( b c )) ((a)) b ) //returns 3
(count 3 '( 1 )) //returns 0
(count none '( )) //returns 0
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
