SHARE
TWEET

Untitled

a guest Feb 27th, 2020 75 Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. (define (task1 spisok)
  2.   (define (iter1 sp0 sp1 sp2 lis)
  3.     (if (or (empty? sp0) (empty? sp1) (empty? sp2)) lis
  4.         (iter1 (cdr sp0) (cdr sp1) (cdr sp2) (cons (list (car sp0) (car sp1) (car sp2)) lis))))
  5.   (define (iter sp0 sp1 sp2 spisok)
  6.     (if (empty? spisok) (iter1 sp0 sp1 sp2 null)
  7.         (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))))
  8.   (iter null null null spisok))
  9.  
  10.  
  11.  
  12.  
  13. (define task2 1)
  14.  
  15. (define (task3 bind)
  16.   (define l (flatten bind))
  17.   (define (iter li s n)
  18.     (if (empty? li) n
  19.         (if (> (car li) s) (iter (cdr li) (car li) 1)
  20.             (iter (cdr li) s (+ (if (= s (car li))1 0) n)))))
  21.   (iter l (car l) 0))
  22.  
  23.  
  24.  
  25.  
  26.  
  27. (define (task4 bind)
  28.   (if (empty? bind) 0
  29.       (if (and (empty? (cadr bind)) (empty? (caddr bind))) 1
  30.           (+ (task4 (cadr bind)) (task4 (caddr bind))))))
  31.  
  32. (define (task5 bind)
  33.   (if (empty? bind) #f
  34.       (if (and (empty? (cadr bind)) (empty? (caddr bind))) #t
  35.           (and (task5 (cadr bind)) (task5 (caddr bind))))))
RAW Paste Data
We use cookies for various purposes including analytics. By continuing to use Pastebin, you agree to our use of cookies as described in the Cookies Policy. OK, I Understand
Top