Advertisement
PonaFly

Untitled

May 16th, 2019
1,000
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Scheme 0.80 KB | None | 0 0
  1. (define (bestnod num lstnum)
  2.   (filter ( λ(a)(< 1 (gcd num a) )) lstnum))
  3. (define (Maxnod n lst)
  4. (define (maxnod n lst)
  5.   (define newnod (bestnod n lst))
  6.   (if (empty? newnod) (cons 1 (list n))
  7.       (let ( (nowres (foldl (λ (newnum newpair)
  8.                               (define x (maxnod newnum (remove newnum lst)))
  9.                               (if (> (car x) (car newpair)) x newpair)) (cons 0 '()) newnod)))
  10.         (cons (+ 1 (car nowres)) (cons n (cdr nowres))))))
  11.   (cdr (maxnod n lst)))
  12.  
  13. (define (Mygraph graph)
  14.   (define (fun n)
  15.     (if (= n (length graph))
  16.         null
  17.         (cons (foldl (lambda (x rez)
  18.                        (if (member n x)
  19.                            (cons (index-of graph x) rez)
  20.                            rez)) null graph) (fun (+ 1 n)))))
  21.   (fun 0))
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement