[rjain-utils-cvs] CVS formulate/examples

rjain rjain at common-lisp.net
Thu Nov 19 00:41:58 UTC 2009


Update of /project/rjain-utils/cvsroot/formulate/examples
In directory cl-net:/tmp/cvs-serv27901/examples

Modified Files:
	simple.lisp 
Log Message:
another formulated class for more interesting testing


--- /project/rjain-utils/cvsroot/formulate/examples/simple.lisp	2009/11/11 08:57:21	1.3
+++ /project/rjain-utils/cvsroot/formulate/examples/simple.lisp	2009/11/19 00:41:57	1.4
@@ -25,6 +25,20 @@
    (area formula-p t :initform (expt (my 'side) 2) :reader area))
   (:metaclass formulated-class))
 
+(defclass polygon ()
+  ((side :initarg side :initform 0 :accessor polygon-side)
+   (num-sides :initarg num-sides :initform 1 :accessor polygon-num-sides)
+   (perimeter formula-p t
+              :initform (* (my 'side) (my 'num-sides))
+              :reader perimeter)
+   (area formula-p t
+         :initform (* 1/4
+                      (my 'num-sides) 
+                      (expt (my 'side) 2)
+                      (/ (tan (/ pi (my 'num-sides)))))
+         :reader area))
+  (:metaclass formulated-class))
+
 (defclass circle ()
   ((radius :initform 0 :initarg radius :accessor circle-radius)
    (perimeter formula-p t :initform (* (my 'radius) 2 pi) :reader perimeter)





More information about the Rjain-utils-cvs mailing list