Advertisement
PonaFly

Untitled

Mar 20th, 2019
901
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Scheme 0.77 KB | None | 0 0
  1. ;ПЕРВАЯ ИЗ НОВОЙ ЛАБЫ
  2. (define (Fano lst)
  3.  (define lst1 (map length ( map (λ (x) (cdr x)) lst)))
  4.   (define lst2 ( map (λ (x) (cdr x)) lst))
  5.    (define (MinLen lst1 mim)
  6.      (if (empty? lst1) mim
  7.          (if (< mim (car lst1)) (MinLen (cdr lst1) mim)
  8.              (MinLen (cdr lst1) (car lst1)))))
  9.   (define Cut ( map ( λ (x) (take x (MinLen lst1 (car lst1)))) lst2))
  10.   (define Cut2 ( map ( λ (x) (take-right x (MinLen lst1 (car lst1)))) lst2))
  11.   (define (fAnO x lst)
  12.     (if (empty? lst) #t
  13.         (if (equal? x (car lst)) #f
  14.             (fAnO x (cdr lst)))))
  15.      (define (fano lst3)
  16.        (if (empty? lst3) #t
  17.            (if (not (fAnO (car lst3) (cdr lst3))) #f
  18.                (fano (cdr lst3)))))
  19.   (or (fano Cut) (fano Cut2)))
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement