[lisplab-cvs] r115 - src/io

Jørn Inge Vestgården jivestgarden at common-lisp.net
Sat Nov 14 20:49:18 UTC 2009


Author: jivestgarden
Date: Sat Nov 14 15:49:18 2009
New Revision: 115

Log:
changed convention for dlmwrite paramter order

Modified:
   src/io/level3-io-interface.lisp
   src/io/level3-io.lisp

Modified: src/io/level3-io-interface.lisp
==============================================================================
--- src/io/level3-io-interface.lisp	(original)
+++ src/io/level3-io-interface.lisp	Sat Nov 14 15:49:18 2009
@@ -19,7 +19,7 @@
 
 (in-package :lisplab)
 
-(defgeneric dlmwrite (matrix file-or-stream &key dlm printer)
+(defgeneric dlmwrite (file-or-stream matrix &key dlm printer)
   (:documentation "Write matrix to ASCII-delimited file or stream"))
 
 (defgeneric dlmread (class in)

Modified: src/io/level3-io.lisp
==============================================================================
--- src/io/level3-io.lisp	(original)
+++ src/io/level3-io.lisp	Sat Nov 14 15:49:18 2009
@@ -32,7 +32,6 @@
 (defmacro in-dir (dir &body body)
   "Temperarily binds *default-pathname-defaults* to dir. When directory
 does not exists, it is created."
-  ;; TODO move to the part dealing with files
   (let ((path (gensym))
         (dir2 (gensym)))
     `(let* ((,dir2 ,dir)
@@ -46,12 +45,12 @@
        (let ((*default-pathname-defaults* ,path))
 	 , at body))))
 
-(defmethod dlmwrite ((x number) out &key (printer #'prin1) dlm)
+(defmethod dlmwrite (out (x number) &key (printer #'prin1) dlm)
   (declare (ignore dlm))
   (dlmwrite (dcol x) out :printer printer))
 
-(defmethod dlmwrite ((a matrix-base) 
-		     (stream stream)
+(defmethod dlmwrite ((stream stream)
+		     (a matrix-base) 		     
 		     &key 
 		     (dlm " ")
 		     (printer #'prin1))
@@ -62,20 +61,20 @@
       (when (< j (1- (cols a)))
 	(princ dlm stream)))))
 
-(defmethod dlmwrite ((a matrix-base) 
-		     (name pathname)
+(defmethod dlmwrite ((name pathname)
+		     (a matrix-base) 		     
 		     &key 
 		     (dlm " ")
 		     (printer #'prin1))
   (with-open-file (stream name :direction :output :if-exists :supersede)
-    (dlmwrite a stream :dlm dlm :printer printer)))
+    (dlmwrite stream a :dlm dlm :printer printer)))
 
-(defmethod dlmwrite ((a matrix-base) 
-		     (name string)
+(defmethod dlmwrite ((name string)
+		     (a matrix-base) 		     
 		     &key 
 		     (dlm " ")
 		     (printer #'prin1))
-  (dlmwrite a (pathname name) :dlm dlm :printer printer))
+  (dlmwrite (pathname name) a :dlm dlm :printer printer))
 
 (defun dlmread-list (in)
   "Helper function that reads a delimited file as a list of lists."
@@ -110,7 +109,7 @@
 (defmethod dlmread (class (name string))
   (dlmread class (pathname name))) 
 
-(defun pgmwrite (m filename 
+(defun pgmwrite (filename m
 		 &key 
 		 (verbose nil)
 		 (max (mmax m))
@@ -138,7 +137,7 @@
        (format t "pgmwrite ~20A (~3Ax~3A)~%" filename rows cols))
     t))
 
-(defun pswrite (m filename 
+(defun pswrite (filename m
 		&key 
 		(max (mmax m))
 		(min (mmin m)))




More information about the lisplab-cvs mailing list