Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #lang racket
- (define foo (lambda (x s)
- (if (list? s)
- (if (< (length s) 2)
- '()
- (if (list? (first s))
- (append (foo x (first s)) (foo x (rest s)))
- (if (equal? x (first s))
- (append (list (second s)) (foo x (rest s)))
- (foo x (rest s))
- )
- )
- )
- '()
- )
- )
- )
- (foo 'y '(y (3 y 5 y y 8 9) (10 y 12 13 y 15 y) 17))
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement