;; return the number of items in a list (defun counteles (l) (cond ((null l) 0) (t (+ 1 (counteles (cdr l)))))) ;; return the sum of a list of numbers (defun sumeles (l) (cond ((null l) 0) (t (+ (car l)(sumeles (cdr l)))))) ;; return the list of elements of l greater than n (defun gethighs (n l) (cond ((null l) nil) ((> (car l) n) (cons (car l) (gethighs n (cdr l)))) (t (gethighs n (cdr l))))) ;; return the list of numbers input before a zero is input (defun readlist () (print 'EnterNumbers) (terpri) (readmore (read))) ;; help function for readlist, processes last number read ;; get next number of this one is not zero (defun readmore (n) (cond ((= n 0) (print 'done) (terpri) nil) (t (cons n (readmore (read)))))) ;; find the average and print the numbers from l above the avg (defun printaboveavg (l) (terpri) (print 'Given:) (print l) (terpri) (print 'ThoseAboveAvgAre) (terpri) (print (gethighs (/ (sumeles l) (counteles l)) l)) (terpri) 'done) ;; input the list and call the function to print numbers > avg (defun main() (printaboveavg (readlist)))