I'm having some troubles with Common Lisp. I want to do a code to find how many times the values of a list are over or under two limits. I want to do a sweep on a list and evaluate if the current value is over or under the limits.
The output shall be the list with two values, the number of values in the list larger than the upper limit, and the number of those under the lower limit. I tried with the following code:
(defun find-inlist
(y)
(setq upper 0)
(setq lower 0)
(loop for element in y (if (< element 32)(+ lower 1)
(if (> elemen 212)(+ 1 upper))))
(list upper lower))
I used the following test case but I got an error message that I don't understand:
> find-inlist '(18 75 31 180 270 52 10 215)
Error: LOOP keyword expected in (... (IF (< ELEMENT 32)
(+ LOWER 1) (IF (> ELEMEN 212) (+ 1 UPPER))))
counting X into Yloop form.LET.