bug-apl
[Top][All Lists]
Advanced

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

Re: [Bug-apl] Request to improve diadic ⎕cr


From: Juergen Sauermann
Subject: Re: [Bug-apl] Request to improve diadic ⎕cr
Date: Sat, 14 Mar 2015 18:35:54 +0100
User-agent: Mozilla/5.0 (X11; Linux i686; rv:31.0) Gecko/20100101 Thunderbird/31.4.0

Hi Xtian,

I have added axis lengths as suggested. SVN 561. If the rank is > 2 then the axis lengths of the higher
dimensions are shown one the same vertical frame line (which I find less ugly than adding additional
frame lines).

I was wrong when I said that indicates empty values (it was long time ago when I implemented that).
Empty values are indicated by and and the box then shows the prototype of the empty value.
The (or several) indicates a nested value (and 8 ⎕CR automatically encloses its right argument).

There is no such thing as an aggregate in GNU APL - all values are treated as possibly mixed and/or nested.
Therefore the idea of an integer value or character value is IMHO a left-over from old APL times where the
data type was in fact a property of the entire value and not a property of each ravel element. Displaying
such a property in the value frame (which shows only properties of the entire value) would therefore not
be very plausible.

The new ⎕CR values are 20-24 for different frame styles.

/// Jürgen


On 03/14/2015 03:50 AM, Christian Robert wrote:
on Gnu APL:

      8 ⎕cr (3 4 ⍴ ⍳12) (4 5 ⍴ ⍳20)
┌→────────────────────────────┐
│┌→─────────┐ ┌→─────────────┐│
│↓1  2  3  4│ ↓ 1  2  3  4  5││
││5  6  7  8│ │ 6  7  8  9 10││
││9 10 11 12│ │11 12 13 14 15││
│└──────────┘ │16 17 18 19 20││
│             └──────────────┘│
└∊────────────────────────────┘

You said: For example ∈ indicates an empty item in APL2 and not an aggregate (whatever that may be).

the '∊' means an agregate to me (a mixup of several things)

the fact that it display as '∊' or '∈' is not meaningfull in itself.

well, it was a suggestion to make it more user friendly as (edited by hand below)

┌2────────────────────────────┐
│┌4─────────┐ ┌5─────────────┐│
│31  2  3  4│ 4 1  2  3  4  5││
││5  6  7  8│ │ 6  7  8  9 10││
││9 10 11 12│ │11 12 13 14 15││
│└~─────────┘ │16 17 18 19 20││
│             └~─────────────┘2
└∊────────────────────────────┘

an other example:

      a←4 4 ⍴ ⍳16
      b←⍕a
      a b
  1  2  3  4    1  2  3  4
  5  6  7  8    5  6  7  8
  9 10 11 12    9 10 11 12
 13 14 15 16   13 14 15 16
      8 ⎕cr a b
┌→──────────────────────────┐
│┌→──────────┐ ┌→──────────┐│
│↓ 1  2  3  4│ ↓ 1  2  3  4││
││ 5  6  7  8│ │ 5  6  7  8││
││ 9 10 11 12│ │ 9 10 11 12││
││13 14 15 16│ │13 14 15 16││
│└───────────┘ └───────────┘│
└∊──────────────────────────┘

no thing distinguishes 'a' and 'b'

it should display as:

┌2──────────────────────────┐
│┌4──────────┐ ┌11─────────┐│
│4 1  2  3  4│ 4 1  2  3  4││
││ 5  6  7  8│ │ 5  6  7  8││
││ 9 10 11 12│ │ 9 10 11 12││
││13 14 15 16│ │13 14 15 16││
│└~──────────┘ └───────────┘│
└∊──────────────────────────┘

Xtian.


Xtian.

On 2015-03-13 14:44, Juergen Sauermann wrote:
Hi Xtian,

I will look into this. However a few things seem to conflict with how GNU APL (and IBM APL2) do it
and I believe this would create too much confusion to be helpful.

/// Jürgen


For example ∈ indicates an empty item in APL2 and not an aggregate (whatever that may be).

On 03/13/2015 02:20 AM, Christian Robert wrote:
On my "still" prefered platform (nars2000) '⎕fmt var' is equivalent to the gnu apl '8 ⎕cr var'

but on that platform ⎕fmt gives more info and this is probably not hard
to implement also into gnu apl.

here some examples in nars2000

      a←⍳10
      ⎕fmt a
┌10──────────────────┐
│1 2 3 4 5 6 7 8 9 10│
└~───────────────────┘
      ⍝ the '~' indicate it is an array of numbers, chars would be the usual '─'
      ⍝ the '10' is the size

      b←3 3 ⍴⍳9
      ⎕fmt b
┌3────┐
31 2 3│
│4 5 6│
│7 8 9│
└~────┘
      ⎕fmt a b
┌2─────────────────────────────┐
│┌10──────────────────┐ ┌3────┐│
││1 2 3 4 5 6 7 8 9 10│ 31 2 3││
│└~───────────────────┘ │4 5 6││
│                       │7 8 9││
│                       └~────┘2
└∊─────────────────────────────┘
      ⍝ the '∊' indicate an agregate
      ⍝ the '2' at rightmost is the '≡' (i think)

      c←3 3 3 ⍴ 'abcdefghijklmnopqrstuvwxyz0'
      ⎕fmt c
┌┬3──┐
33abc│
││def│
││ghi│
││   │
││jkl│
││mno│
││pqr│
││   │
││stu│
││vwx│
││yz0│
└┴───┘
      ⍝ above, it says it is a 3 dimentioanl array of type 'char'
      d←3 3 3 ⍴ ⍳27
      ⎕fmt d
┌┬3───────┐
33 1  2  3│
││ 4  5  6│
││ 7  8  9│
││        │
││10 11 12│
││13 14 15│
││16 17 18│
││        │
││19 20 21│
││22 23 24│
││25 26 27│
└┴~───────┘
      ⍝ above it says it is a 3 dimentioanl array of type 'numbers'

      e←(a b c d)
      ⎕fmt e
┌4────────────────────────────────────────────────┐
│┌10──────────────────┐ ┌3────┐ ┌┬3──┐ ┌┬3───────┐│
││1 2 3 4 5 6 7 8 9 10│ 31 2 3│ 33abc│ 33 1  2  3││
│└~───────────────────┘ │4 5 6│ ││def│ ││ 4  5  6││
│                       │7 8 9│ ││ghi│ ││ 7  8  9││
│                       └~────┘ ││   │ ││        ││
│                               ││jkl│ ││10 11 12││
│                               ││mno│ ││13 14 15││
│                               ││pqr│ ││16 17 18││
│                               ││   │ ││        ││
│                               ││stu│ ││19 20 21││
│                               ││vwx│ ││22 23 24││
│                               ││yz0│ ││25 26 27││
│                               └┴───┘ └┴~───────┘2
└∊────────────────────────────────────────────────┘
      ⍝ above, an agregate  of 4 things

      f←e e
      ⎕fmt f
┌2──────────────────────────────────────────────────────────────────────────────────────────────────────┐
│┌4────────────────────────────────────────────────┐ ┌4────────────────────────────────────────────────┐│
││┌10──────────────────┐ ┌3────┐ ┌┬3──┐ ┌┬3───────┐│ │┌10──────────────────┐ ┌3────┐ ┌┬3──┐ ┌┬3───────┐││
│││1 2 3 4 5 6 7 8 9 10│ 31 2 3│ 33abc│ 33 1  2  3││ ││1 2 3 4 5 6 7 8 9 10│ 31 2 3│ 33abc│ 33 1  2  3│││
││└~───────────────────┘ │4 5 6│ ││def│ ││ 4  5  6││ │└~───────────────────┘ │4 5 6│ ││def│ ││ 4  5  6│││
││                       │7 8 9│ ││ghi│ ││ 7  8  9││ │                       │7 8 9│ ││ghi│ ││ 7  8  9│││
││                       └~────┘ ││   │ ││        ││ │                       └~────┘ ││   │ ││        │││
││                               ││jkl│ ││10 11 12││ │                               ││jkl│ ││10 11 12│││
││                               ││mno│ ││13 14 15││ │                               ││mno│ ││13 14 15│││
││                               ││pqr│ ││16 17 18││ │                               ││pqr│ ││16 17 18│││
││                               ││   │ ││        ││ │                               ││   │ ││        │││
││                               ││stu│ ││19 20 21││ │                               ││stu│ ││19 20 21│││
││                               ││vwx│ ││22 23 24││ │                               ││vwx│ ││22 23 24│││
││                               ││yz0│ ││25 26 27││ │                               ││yz0│ ││25 26 27│││
││                               └┴───┘ └┴~───────┘2 │                               └┴───┘ └┴~───────┘2│
│└∊────────────────────────────────────────────────┘ └∊────────────────────────────────────────────────┘3
└∊──────────────────────────────────────────────────────────────────────────────────────────────────────┘


Thoses informations are particuliarly usefull for everyone testing/developping
and the actual ]boxing 8 (and 8 ⎕cr) function already know
thoses values (size, rank, types, ...), so they can plug the info into the *actual* boxes.

I dont mind if you update the actual behavior or define a new set of ⎕cr function number
or rather define a quite new ⎕fmt to do this. It is quite missing.

my 2 cents, (would love to see something like that into gnuapl)

Xtian.







reply via email to

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