Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- (define (even-nums list)
- (if (null? list)
- 0
- (begin
- (let ((res (if (equal? (modulo (car list) 2) 0) 1 0)))
- (+ res (even-nums (cdr list))))
- )
- )
- )
- (define (findList list)
- (if (null? list)
- '()
- (if (list? (car list))
- (cons (car list) (cdr list))
- (findList (cdr list))
- )
- )
- )
- (define (extract-lists list)
- (if (null? list)
- '()
- (let ((firstList (findList list)))
- (if (equal? firstlist '())
- '()
- (begin
- (cons (car firstList) (extract-lists (cdr firstList)))
- )
- )
- )
- )
- )
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement