It might be useful ...
1) ... to rewrite function read_list and others for reading list (array,
matrix) of expressions (not only of numbers).
write_data(
matrix([2/5,3/7,-1/2],[0.5,-1.247,12.57]),
"D:/Compmath/temp_matrix", comma
)$
- it works correctly
read_matrix("D:/Compmath/temp_matrix", comma);
- returns a rubbish
my_read_matrix(fn):=block([f,A,s],
if (file_search(fn)=fn) then (
f:openr(fn),
A:matrix(),
while (s:readline(f))#false do
A:addrow(A,eval_string(concat("[",s,"]")))
),
A
)$
my_read_matrix("D:/Compmath/temp_matrix");
- works correctly
2) ... to add some functions for write and read arbitrary text-file, for
example:
(defun $fwrite (f &rest c)
(with-open-file (stream f :direction :output)
(loop for s in c
do (write-line s stream))))
Usage:
fwrite("D:/Compmath/temp_file.txt",
"a string",
"another string",
"again another string"
)$