Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #lang racket
- (define (at-level lst n curdepth)
- (cond
- [(empty? lst) empty]
- [(list? (first lst)) (append
- (at-level (first lst) n (+ 1 curdepth))
- (at-level (rest lst) n curdepth))]
- [(= n curdepth) (cons (first lst) (at-level (rest lst) n curdepth))]
- [(at-level (rest lst) n curdepth)]))
- (define a '(1 2 (3 4) 5 (6 7)))
- (at-level a 2 1)
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement