(lambda a (let ((p (apply (fileVal "Poly/qr") a))) (ylppa (p 'ply) (lambda (pa ps pm sm pp) (let* ((bug #f)(one (cadddr (cddddr a))) (Pp (lambda (m p) (if (and (pair? p) (pp (car p)) (pp (cdr p)) (eq? one (car (reverse (cdr p))))) (begin (if #t (begin (write (list m p)) (newline))) p) (begin (write (list m p one)) (newline) (/ 0))))) (P1 (lambda (m fun) (if bug (lambda (a) (Pp (cons 0 m) (fun (Pp (cons 1 m) a)))) fun))) (P2 (lambda (m fun) (if bug (lambda (a b) (Pp (cons 0 m) (fun (Pp (cons 1 m) a) (Pp (cons 2 m) b)))) fun)))) (let* ((g (p 'gcd)) (qr (p 'qr)) (add (lambda (a b) (let* ( (cd (g (cdr a)(cdr b))) (la (car (qr (cdr a) cd))) (lb (car (qr (cdr b) cd))) (sum (cons (pa (pm la (car b)) (pm lb (car a))) (pm (cdr a) lb))) (ft (g (car sum) (cdr sum)))) (cons (car (qr (car sum) ft)) (car (qr (cdr sum) ft)))))) (mul (lambda (a b) (let* ((p (pm (car a) (car b)))(q (pm (cdr a) (cdr b))) (c (g p q))) (cons (car (qr p c)) (car (qr q c))))))) (list (cons '() '(1)) (lambda (x) (null? (car x))) (cons '(1) '(1)) (P2 'add add) (P2 'sub (lambda (a b) (add a (cons (sm -1 (car b)) (cdr b))))) (P2 'mul mul) (P1 'inv (ylppa a (lambda (/ d1 d2 d3 d4 * d5 d6) (lambda (a) (let* ( (i (/ (let r ((z (car a))) (if (null? (cdr z)) (car z) (r (cdr z)))))) (f (lambda (a) (let r ((a a)) (if (null? a) a (cons (* (car a) i) (r (cdr a)))))))) (cons (f (cdr a)) (f (car a))))))))))))))) ; tests (define (rv m v) (write (list m v)) (newline) v) (let* ((ri (((fileVal "RC4") "fraT") 'sb)) (rp (lambda (h) (let r () (if (< (ri) 100) h (let ((v (- (ri) 128)) (w (r))) (if (and (null? w) (= 0 v)) '() (cons v w))))))) (rf (lambda () (cons (rp '()) (rp '(1))))) (pv ((fileVal "Poly/pv") 0 + *)) (DoL ((fileVal "Do") 'DoL))) (ylppa ((fileVal "Poly/tfe") / 0 zero? + - * number? 1) (lambda (zer zer? one add sub mul inv) (list (add one one) (DoL 10 (lambda (j) (rp '()))) (DoL 10 (lambda (j) (rf))) (let u ((n 100)) (if (= 0 n) #t (and (let ((a (rf))(b (rf)) (c (rf))) (and (zer? (sub (mul a (add b c)) (add (mul a b) (mul a c)))) (zer? (sub (add a (add b c)) (add (add a b) c))))) (u (- n 1))))) (let* ((pv ((fileVal "Poly/pv") 0 + *)) (v (lambda (r) (/ (pv (car r) 4/7) (pv (cdr r) 4/7))))) (let u ((n 100)) (if (= 0 n) #t (and (let ((a (rf))(b (rf))) (and (= (v (add a b)) (+ (v a) (v b))) (= (v (mul a b)) (* (v a) (v b))) (= (v (sub a b)) (- (v a) (v b))) (or (null? (car a)) (= (v (inv a)) (/ (v a)))))) (u (- n 1)))))))))) ; last two elements of list should be #t #t