I am trying to find the mode of a list
Assuming the list is sorted ascending order
Here is my mode function
(define freq
(lambda (l)
(cond ((null? l)l)
((null? (cdr l))l)
((not(equal? (car l) (car(cdr l))))(freq(cdr(delete l (car l)))))
(else (freq (cdr l)))
)))
(freq '(4 4 4 4 5 7 9 9 9)) => should returns 4 but its returning 9 instead