;1.1

(defun F(L)
    ((lambda (x)
    (
        (cond
            ((null L) 0)
            ((> x 2) (+ (car L) (F (cdr L))))
            (t x)
        )
    )
    )(F (car L)))
)

; 1.3 

;(1 2 3 4 5 7)

;3
; replace_with_zero(lst k level)=
;   nil     if lst is null
;   0       if lst is atom and level=k and lst is not null
;   lst     if lst is atom and level!=k and lst is not null
;   U replace_with_zero(l_i k level+1) where l_i in lst, otherwise

(defun replace_with_zero (lst k &optional (level 0))
    (cond
        ((null lst) nil)
        ((and (atom lst) (= level k)) 0)
        ((atom lst) lst)
        (t (mapcar #'(lambda (x) (replace_with_zero x k (+ level 1))) lst))
    )
)

(print (replace_with_zero '(a (1 (2 b)) (c (d))) 2))
(exit)