Update of /project/movitz/cvsroot/movitz/losp/muerte In directory clnet:/tmp/cvs-serv22550
Modified Files: complexes.lisp Log Message: Add defun complex.
--- /project/movitz/cvsroot/movitz/losp/muerte/complexes.lisp 2008/03/20 22:21:01 1.1 +++ /project/movitz/cvsroot/movitz/losp/muerte/complexes.lisp 2008/04/21 19:31:32 1.2 @@ -6,7 +6,7 @@ ;;;; Author: Frode Vatvedt Fjeld ;;;; Distribution: See the accompanying file COPYING. ;;;; -;;;; $Id: complexes.lisp,v 1.1 2008/03/20 22:21:01 ffjeld Exp $ +;;;; $Id: complexes.lisp,v 1.2 2008/04/21 19:31:32 ffjeld Exp $ ;;;; ;;;;------------------------------------------------------------------
@@ -18,6 +18,14 @@ (provide :muerte/complexes)
(defstruct (complex (:constructor make-complex-number) - (:conc-name "")) + (:conc-name #:||)) realpart imagpart) + +(defun complex (realpart &optional (imagpart 0)) + (check-type realpart real) + (check-type imagpart real) + (if (= 0 imagpart) + realpart + (make-complex-number :realpart realpart + :imagpart imagpart)))