So I am still relatively new to acl2 and lisp, I do not know of a way to do this in lisp. How can i go about achieving my comment?(cons a...) I keep thinking iterator, but i have been told ACL2 only uses recursion
(defun keep-at-most-n-bits (l n)
;cons a (up to n)
)
;;;unit tests.
(check-expect (keep-at-most-n-bits '(1 0 1 1) 3) '(1 0 1))
(check-expect (keep-at-most-n-bits '(1 0 1 1) 2) '(1 0))
(check-expect (keep-at-most-n-bits '(1 0 1 1) 8) '(1 0 1 1))