I have list in this form
( (1 3) (2 2) (3 1) (4 5) (5 1)))
and I want to delete an item let\'s say (3 1)
So the result wi
The procedure already exists:
(remove '(3 1) '((1 3) (2 2) (3 1) (4 5) (5 1))))
Otherwise your procedure should look like this:
(define (deleteItem item list)
(cond
((empty? list) '())
((equal? item (car list)) (cdr list))
(else (cons (car list) (deleteItem item (cdr list))))))
You missed:
and you shouldn't use list as a variable name because it shadows the build-in procedure list
(but it will work).