Matt Coles лет назад: 10
Родитель
Сommit
43c8c8b2e6
1 измененных файлов с 24 добавлено и 0 удалено
  1. 24 0
      poly.cl

+ 24 - 0
poly.cl

@@ -0,0 +1,24 @@
1
+(defun poly+ (poly1 poly2)
2
+  (format t "Poly One: ~d~%" poly1)
3
+  (format t "Poly Two: ~d~%" poly2)
4
+  (if (equal (length poly1) 1)
5
+    (format t "Poly 1 has exactly one term: ~a Ex: ~a Mul: ~a~%" 
6
+            (find-variable-symbol poly1)
7
+            (find-exponent        poly1)
8
+            (find-multiplier      poly1))
9
+    (format t "Poly 1 has more than one term~%")))
10
+
11
+(defun collect-like-terms (poly)
12
+  (format t "collecting terms"))
13
+
14
+(defun find-variable-symbol (single-poly)
15
+  (car (car (car single-poly))))
16
+
17
+(defun find-exponent (single-poly)
18
+  (cdr (car (car single-poly))))
19
+
20
+(defun find-multiplier (single-poly)
21
+  (cdr (car single-poly)))
22
+
23
+(poly+ '(((x 2) 3)) '(((y 2) 4)))
24
+(poly+ '(((x 2) 3) ((y 2) 3)) '(((y 2) 4)))