我正在尝试将一些参数传递给一个将列添加到平面文件的新函数。电话是这样的:
(add-col-to-ff '(:absolute "home" "lambda" "Documents") "test-col-col"
'(:absolute "home" "lambda" "Documents") "test-col-ff"
'(:absolute "home" "lambda" "Documents") "test-col-new.txt")
但是 SLIME 返回错误:
#<SB-SYS:FD-STREAM for "file /home/lambda/Documents/test-col-new.txt"
{B50D7E1}> is not a character input stream.
[Condition of type SIMPLE-TYPE-ERROR]
Backtrace:
0: (SB-KERNEL:ILL-IN #<SB-SYS:FD-STREAM for "file /home/lambda/Documents/test-
col-new.txt" {B50D7E1}>)
我想知道,我在这里错过了什么?流布局似乎很好:
(defun add-col-to-ff (col-dir col-file
ff-dir ff-file
out-dir out-file)
(let ((M (make-ff-array ff-dir ff-file))
(vec (vec-from-1col-ff col-dir col-file))
(path (make-pathname :name out-file
:directory out-dir)))
(with-open-file (addcol-str path :direction :output)
(do ((line (read-line addcol-str nil 'eof)
(read-line addcol-str nil 'eof))
(i 0 (1+ i)))
((eql i (array-dimension M 1)))
(dotimes (k (array-dimension M 0))
(cond ((eql (1+ k) (array-dimension M 0))
(format addcol-str "~A ~A~%" (aref M i k) (svref vec k)))
((and (eql (1+ i) (array-dimension M 1))
(eql (1+ k) (array-dimension M 0)))
(format addcol-str "~A ~A" (aref M i k) (svref vec k)))
(t (format addcol-str "~A " (aref M i k)))))))))