Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- (defun bajar-atomos (L)
- (labels ((depth (l)
- (cond ((null l) 0)
- ((atom (car l)) (depth (cdr l)))
- (t (max (1+ (depth (car l)))
- (1+ (depth (cdr l)))))))
- (rec (l target &optional (depth 1))
- (cond ((null l) nil)
- ((atom (car l)) (if (= target depth)
- nil
- (cons (car l)
- (rec (cdr l) target depth))))
- (t (cons (rec (car l) target (1+ depth))
- (rec (cdr l) target depth))))))
- (rec L (depth L))))
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement