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: Fri, 13 Mar 2015 19:44:16 +0100
User-agent: Mozilla/5.0 (X11; Linux i686; rv:31.0) Gecko/20100101 Thunderbird/31.4.0

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]