|
From: | Louis de Forcrand |
Subject: | Re: [Bug-apl] working with )HOST |
Date: | Sun, 6 Mar 2016 01:35:02 +0100 |
I am not very good with files and such, but from what I understand: ⎕←T←⊃¯1↓⍎')HOST date' Sun Mar 6 01:11:48 CET 2016 ⍴T 2 28 So you can save the result of )HOST in a variable if you use ⍎. To feed it a var, I would try something like: ]BOXING 2 ⎕←FILE←⍎')HOST cat test.txt' hello, world This file was written in my $HOME directory. 0 ⍴FILE 5 FILE .→-----------. .⊖. .→-------------------------------------------. .⊖. .→-. |hello, world| | | |This file was written in my $HOME directory.| | | |0 | '------------' '-' '--------------------------------------------' '-' '--' Several things to note here. First of all, linefeeds / carriage returns / whatever you want to call them in the file I read seemed to mark nested array ends, and it seems that those LFs were lost. I don’t know how GNU APL handles LF chars, so I would recommend you either keep the array boxed or disclose it like I did in the first example (∊ enlisting it simply catenated all the lines together, as the LFs were represented by ⊂⍬, boxed empty vectors). Second, if you’re reading this Jürgen, note that even though ]BOXING was set to 2, the result of ⎕←FILE is not boxed. IMHO this is potentially the cleanest way to read a file. I have no idea how to tie files and stuff like that. Best of luck, Louis
|
[Prev in Thread] | Current Thread | [Next in Thread] |