[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [Bug-apl] quad-PW and text
From: |
David B. Lamkins |
Subject: |
Re: [Bug-apl] quad-PW and text |
Date: |
Sun, 25 May 2014 09:54:14 -0700 |
Ah. You're right: I didn't consider the other cases. (My world-view is
still strongly advised by Common Lisp.)
No worries. I'm happy to read and display by line. It's a bit more code,
but it has the benefit of not needing the entire file in memory.
Also, as I discovered after having posted, I need to do a UTF-8 to UCS-2
translation; my original plan of reading and dumping the blob wouldn't
have worked.
On Sun, 2014-05-25 at 13:43 +0200, Juergen Sauermann wrote:
> Hi David,
>
> actually ⎕PW works quite differently than its output suggests. Just
> resetting
> the print position after \n works for simple text vectors but not for
> text matrices,
> mixed values or nested values.
>
> My proposal would rather be to use FILE_IO[22] (aka printf()) in your
> use case:
>
> (⊂"hello world\nnext line\n") FILE_IO[22] 1
> hello world
> next line
> 22
>
> I could also add a "boxing" function to dyadic ⎕CR or to FILE_IO that
> converts
> strings containing \n to nested vectors of strings. I believe that the
> traditional
> APL format of text matrices is less suitable for longer texts and that
> nested vectors
> of strings should be used for that.
>
> /// Jürgen
>
>
> On 05/25/2014 03:43 AM, David B. Lamkins wrote:
>
> > Enhancement request: Can quad-PW be made aware of newlines?
> >
> > Use case: I'd like to dump a text file to the screen using FILEIO[26],
> > which (for a text file) returns a blob of text containing embedded
> > newlines. Emitting a newline to the session display does not reset the
> > print position. The session adds an additional APL wrap (newline plus
> > indent) every quad-PW characters even though the newlines in the text
> > keep the display well withing the quad-PW limits.
> >
> >
> >
> >
>