Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- ; a. Return T if a list has an even number of elements on the first level, and
- ; NIL otherwise, without counting the elements of the list
- (defun noEven (l)
- (prog ((x t))
- here
- (cond
- ((null l) (setq x t) (return x))
- ((null (cdr l)) (setq x nil) (return x))
- (t (setq l (cddr l)))
- )
- (go here)
- )
- )
- ; b. Check whether a linear list is a set
- (defun isSet (l)
- (prog ((x t))
- there
- (cond
- ((null l) (setq x t) (return x))
- ((member (car l) (cdr l)) (setq x nil) (return x))
- (t (setq l (cdr l)))
- )
- (go there)
- )
- )
Add Comment
Please, Sign In to add comment