[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [Bug-apl] Common IO operations
From: |
Juergen Sauermann |
Subject: |
Re: [Bug-apl] Common IO operations |
Date: |
Sun, 09 Mar 2014 18:34:29 +0100 |
User-agent: |
Mozilla/5.0 (X11; Linux i686; rv:17.0) Gecko/20130330 Thunderbird/17.0.5 |
Hi Elias,
sounds like a case for FILE_IO and partition:
1. get a line with fgets() in FILE_IO
2. call partition (dyadic ⊂)
For example (FILE_IO part omitted):
TEXT←"Hello,World,xyz"
(TEXT≠",")⊂TEXT
Hello World xyz
⍴(TEXT≠",")⊂TEXT
3
⊃((TEXT≠",")⊂TEXT)[1]
Hello
⊃((TEXT≠",")⊂TEXT)[2]
World
⊃((TEXT≠",")⊂TEXT)[3]
xyz
/// Jürgen
On 03/09/2014 03:58 PM, Elias Mårtenson wrote:
A common need that I have is to be able to easily read and write data
from/to files. For me, this data is usually in CSV form.
Up until now, I've loaded them into Emacs and used my tools to push
the tabular data into variables. However, it would be nicer to have
something native in GNU APL itself.
I've been thinking of writing a library of functions using the file_io
native library as the underlying mechanism.
How do other APL's handle this? I've seen the TIE stuff in Dyalog and
Nars, and they seem painful to use.
Regards,
Elias