Hi Alex,
very good, thank you very much. I have added it as:
http://www.gnu.org/software/apl/Bits_and_Pieces/File_Table_Reader.apl.html
//// Jürgen
This revision adds the following:
1.switch from ⎕av to ⎕ucs
2. works for >2 columns
3. Left argument is the record separator. I didn't make it
optional because I like the visual aid in the code rather than
having to remember an arbitrary default case.
4. On Louis' suggestion, it now supports "Quoted Data",
incase your data item contains a comma
5. Against Louis' suggestion, I never count the number of
delimiters and add 1. :)
Please see attached
-Alex
-------- Original Message --------
Subject: Re: [Bug-apl] Submission for GNU APL
Bits_and_Pieces directory
From: Juergen Sauermann < juergen.sauerm...@t-online.de>
Date: Mon, June 29, 2015 3:05 am
To: alexwei...@alexweiner.com,
bug-apl@gnu.org
Hi Alex,
thanks for offering this. I would change a few things to
make that code even more useful:
- make the separator an (ideally optional) left argument
of ReadTableData.
Many data files are written in CSV (comma separated
values) format which uses comma instead of space,
- use ⎕UCS instead of ⎕AV to make the code
more portable between different APL interpreters,
- and maybe make it work for > 2 columns (by guessing
the number of columns from the first line in the file).
/// Jürgen
Hi Bug-apl,
I am soliciting feedback (as per the process) of
the attached APL code that will take a file that has
a layout of two columns (space separator) and return a
matrix.
-Alex
|