bug-apl
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [Bug-apl] Suggested change in rendering of ⎕CR


From: Elias Mårtenson
Subject: Re: [Bug-apl] Suggested change in rendering of ⎕CR
Date: Sun, 17 Apr 2016 00:01:14 +0800

One bug though: I'm not able to specify 29 as a parameter to ]BOXING.

Regards,
Elias

On 16 April 2016 at 23:55, Elias Mårtenson <address@hidden> wrote:
Very nice! It's so much better, that I have to create an example showing just how neat it is.

Here's the result from selecting from a simple table using 8⎕CR:

      8⎕CR 'select * from foo' SQL∆Select[db] ⍬
┌→─────────────────────────────┐
↓ 1 ┌→──┐        ┌→──────┐  832│
│   │foo│        │Value:1│     │
│   └───┘        └───────┘     │
│ 2 ┌→────┐      ┌→──────┐  146│
│   │hello│      │Value:2│     │
│   └─────┘      └───────┘     │
│ 3 ┌→───┐       ┌→──────┐  885│
│   │test│       │Value:3│     │
│   └────┘       └───────┘     │
│ 4 ┌→─────────┐ ┌→──────┐  192│
│   │some value│ │Value:4│     │
│   └──────────┘ └───────┘     │
│ 5 ┌→──┐        ┌→──────┐  182│
│   │foo│        │Value:5│     │
│   └───┘        └───────┘     │
│ 6 ┌→────┐      ┌→──────┐  965│
│   │hello│      │Value:6│     │
│   └─────┘      └───────┘     │
│ 7 ┌→───┐       ┌→──────┐  309│
│   │test│       │Value:7│     │
│   └────┘       └───────┘     │
│ 8 ┌→─────────┐ ┌→──────┐   69│
│   │some value│ │Value:8│     │
│   └──────────┘ └───────┘     │
│ 9 ┌→──┐        ┌→──────┐  774│
│   │foo│        │Value:9│     │
│   └───┘        └───────┘     │
│10 ┌→────┐      ┌→───────┐ 469│
│   │hello│      │Value:10│    │
│   └─────┘      └────────┘    │
└∊─────────────────────────────┘

And here's the same query with 27⎕CR:

      29⎕CR 'select * from foo' SQL∆Select[db] ⍬
┏→━━━━━━━━━━━━━━━━━━━━━━━━━━━━━┓
↓ 1 "foo"        "Value:1"  832┃
┃ 2 "hello"      "Value:2"  146┃
┃ 3 "test"       "Value:3"  885┃
┃ 4 "some value" "Value:4"  192┃
┃ 5 "foo"        "Value:5"  182┃
┃ 6 "hello"      "Value:6"  965┃
┃ 7 "test"       "Value:7"  309┃
┃ 8 "some value" "Value:8"   69┃
┃ 9 "foo"        "Value:9"  774┃
┃10 "hello"      "Value:10" 469┃
┗∊━━━━━━━━━━━━━━━━━━━━━━━━━━━━━┛

Thanks again for this. This is invaluable, especially when working with mixed data.

Regards,
Elias

On 16 April 2016 at 23:25, Juergen Sauermann <address@hidden> wrote:
Hi Elias, Blake,

I have added 29 ⎕CR in SVN 720.

It uses e.g.  'a' for character scalars, "hello" for character strings,
and a double-line frame around character arrays with higher ranks.


      29 ⎕CR 2 3⍴ 1 2.2 'a' "hello" (2 2 3⍴'ABCD')
┏→━━━━━━━━━━━━━━━━━━┓
↓      1     2.2 'a'┃
┃                   ┃
┃                   ┃
┃"hello"   ╔═══╗   1┃
┃          ║ABC║    ┃
┃          ║DAB║    ┃
┃          ║   ║    ┃
┃          ║CDA║    ┃
┃          ║BCD║    ┃
┃          ╚═══╝    ┃
┗∊━━━━━━━━━━━━━━━━━━┛

Hope you like it.

/// Jürgen



On 04/14/2016 02:48 AM, Blake McBride wrote:
Putting quotes around strings is important so you can see leading and trailing blanks.

On Wed, Apr 13, 2016 at 1:07 PM, Juergen Sauermann <address@hidden> wrote:
Hi,

I can look into this. However, how shall we handle character arrays with rank > 1?
Quotes on every line or one quote at the beginning and one at the end (for example)?

If the problem is distinguishing numbers and characters then we could also use a different
frame type (like bold or double-line for characters). That would also be closer to the "normal"
display of APL values (the quotes are input-only).

/// Jürgen


On 04/13/2016 02:38 PM, Elias Mårtenson wrote:

I agree, and specifically I'd suggest using double quotes for an encapsulated array of characters, while using single quotes to indicate the difference between characters and numbers inside an array.

This would be analogous with the GNU APL extension where double quotes ensures arrays even for single characters.

I'm on mobile now so I can't really make any good examples. But I'm hoping you'll understand what I mean.

Regards,
Elias

On 13 Apr 2016 8:26 p.m., "Blake McBride" <address@hidden> wrote:
Off the cuff, it seems like putting quotes around strings is a really good idea.  How else would you tell the difference between 123 and "123"?

Blake

On Wed, Apr 13, 2016 at 2:34 AM, Elias Mårtenson <address@hidden> wrote:
Given the following _expression_:

      8⎕CR 2 2⍴10 'foo' 20 'bar'
┌→───────┐
↓10 ┌→──┐│
│   │foo││
│   └───┘│
│20 ┌→──┐│
│   │bar││
│   └───┘│
└∊───────┘

The combination of strings and numbers in the array isn't very pretty.

I'd like to suggest that it renders as following instead:

┌→───────┐
↓   ┌→──┐│
│10 │foo││
│   └───┘│
│   ┌→──┐│
│20 │bar││
│   └───┘│
└∊───────┘

I would also like to see another ⎕CR mode that would render it like below, as this would make displaying arrays with lots of strings (in my case, database table content) much easier to read:

┌→───────┐
10 "foo"│
│20 "bar"│
└∊───────┘

Jürgen, what's your opinion on this?

Regards,
Elias







reply via email to

[Prev in Thread] Current Thread [Next in Thread]