Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #lang racket
- (define foo (lambda (cond ls)
- (if (null? ls)
- (list)
- (if (list? (first ls))
- (append (foo cond (first ls)) (foo cond (rest ls)))
- ;else:
- (if (cond (first ls))
- (append (list (first ls)) (foo cond (rest ls)))
- ;else:
- (foo cond (rest ls))
- )
- )
- )
- )
- )
- (foo number? '(1 b (3 c 4) 3 f (3 j (4 4 (5 l))) 5 4 h 8))
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement