EIJHHH - never thought about it - COOOL.

⍝IBM APL:

    ⍎ ')HOST ls'

VALUE ERROR

      )HOST ls

            ^

      ⍎')HOST ls'

                 ^

⍝ GNU-APL:

        l ← ⍎ ')HOST ls -1'

And it works:-)) Makes life much easier.

f ← ⍎ ')HOST cat filename'

⍝ returns the file as nested vector
⍝ No intermediate file required.

⍝ Does not like binary data:

      ⍴⍎')HOST cat /OTH/APL/trunk/src/apl-Symbol.o'

Bad UTF8 string: 0x48 0x8B 0x45 0xD8 0x48 0x83 0xC0 0x30 0xEB 0x05 0xB8 at UCS_string.cc:120 .....




doc/apl.info (incorrectly) reads:
snip
Like system commands, user-define commands can only be executed in immediate
execution mode and *not* from user-defined functions or *from ⍎.*
/snip


A last thought:
How to connect apl-command_line to host-stdin? Like

        &⍞ ← 'test test test'
        ⍎ ')HOST &0  > data_entry_from_apl'


OK - Just a weekend. Asking too much:-)

Best Regards
Hans-Peter






Am 31.10.20 um 14:39 schrieb Dr. Jürgen Sauermann:
Hi,

On 10/30/20 6:14 PM, Kacper Gutowski wrote:
On Fri, Oct 30, 2020 at 02:34:35PM +0100, Dr. Jürgen Sauermann wrote:
There is also ⎕FIO[26] which reads an entire file, but I am not sure how it works with popen()ed streams.

It doesn't at all because it takes a path which additionally needs to be a regular file because it's mmaped rather than read.

For the record, something like ⍎')HOST ...' might sometimes be practical.

-k
That is actually a cool idea: run your pipe or program with )HOST, forward the output into some /tmp/xxx and read back /tmp/xxx. It also gives you some more
control over using stdout, stderr, or both from the executed program .

Jürgen


Reply via email to