I want create a function that verify if the numbers of a list fall between the range of 1 and 10 (including the 1 and 10). If they do, I wanted to add it to a new list that I created. However, if they fail to fall within the range I decided to convert them so they fit in rather than discarding them (by adding (1+ (random 10)).
(defun fit (lst)
"(lst) check every number if it fits the range (1-10)"
(do ((fit lst (cdr fit))
(range nil))
((null fit) (reverse range))
(if (and (>= fit 1) (=< fit 10))
(seft ((cons fit range))))
(or (< fit 1) (> fit 10))
(cons (+ fit (1+ (random 10))) range)))
The codes start from (defun fit...). However, it's not working and I'm at short of any type of changes I can do mainly because of my limited knowledge. Any help or insight will be greatly appreciated. Thank you.