Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- (define (task1 spisok)
- (define (iter1 sp0 sp1 sp2 lis)
- (if (or (empty? sp0) (empty? sp1) (empty? sp2)) lis
- (iter1 (cdr sp0) (cdr sp1) (cdr sp2) (cons (list (car sp0) (car sp1) (car sp2)) lis))))
- (define (iter sp0 sp1 sp2 spisok)
- (if (empty? spisok) (iter1 sp0 sp1 sp2 null)
- (iter (if (= (remainder (car spisok) 3) 0) (cons (car spisok) sp0) sp0) (if (= (remainder (car spisok) 3) 1) (cons (car spisok) sp1) sp1) (if (= (remainder (car spisok) 3) 2) (cons (car spisok) sp2) sp2) (cdr spisok))))
- (iter null null null spisok))
- (define task2 1)
- (define (task3 bind)
- (define l (flatten bind))
- (define (iter li s n)
- (if (empty? li) n
- (if (> (car li) s) (iter (cdr li) (car li) 1)
- (iter (cdr li) s (+ (if (= s (car li))1 0) n)))))
- (iter l (car l) 0))
- (define (task4 bind)
- (if (empty? bind) 0
- (if (and (empty? (cadr bind)) (empty? (caddr bind))) 1
- (+ (task4 (cadr bind)) (task4 (caddr bind))))))
- (define (task5 bind)
- (if (empty? bind) #f
- (if (and (empty? (cadr bind)) (empty? (caddr bind))) #t
- (and (task5 (cadr bind)) (task5 (caddr bind))))))
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement