CSc 404 Assignment 1

Recursion Counts!

Assigned
Due

Jan 22
35 pts
Jan 31

Create a Tom's lisp function count which takes two arguments, an arbitrary item and an arbitrary list. It returns the number of times that the item appears in the list. Use the equal? function to compare. Place your definition in a text file which can be loaded into the tomslsp program. For instance:

Welcome to Tom's Lisp 0.95. Recur well. lsp>(load "count.lsp") count lsp>(count 5 '(4 9 11 5 fred -4 2 5 1)) 2 lsp>(count 'joe '(joe bill frank alice joe jane joe frank joe)) 4 lsp>(count 'al '(There is no one here by that name)) 0 lsp>(count '(a b c) '(a b (a b c) c (a c) a b c c (c b) (a b c d))) 1 lsp>(count 'mike ()) 0

When your function works, is nicely formatted and documents, submit it using this form.