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

Hi Xtian,

yes, I thought about that in the meantime, but then I forgot it. SVN 563.

/// Jürgen


On 03/16/2015 01:15 AM, Christian Robert wrote:
I was quite surprized to see an implementation so fast !

address@hidden:/home/xtian] $ aplt

                    ______ _   __ __  __    ___     ____   __
                   / ____// | / // / / /   /   |   / __ \ / /
                  / / __ /  |/ // / / /   / /| |  / /_/ // /
                 / /_/ // /|  // /_/ /   / ___ | / ____// /___
                 \____//_/ |_/ \____/   /_/  |_|/_/    /_____/

                     Welcome to GNU APL version 1.4 / 9321

                Copyright (C) 2008-2014  Dr. Jürgen Sauermann
                       Banner by FIGlet: www.figlet.org

                This program comes with ABSOLUTELY NO WARRANTY;
                  for details run: /usr/local/bin/apl --gpl.

     This program is free software, and you are welcome to redistribute it
         according to the GNU Public License (GPL) version 3 or later.

      24 ⎕cr a←5 5 ⍴⍳25
┌5─────────────┐
5 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│
└──────────────┘
      b←⍕a
      24 ⎕cr a b
┌2────────────────────────────────┐
│┌5─────────────┐ ┌14────────────┐│
│5 1  2  3  4  5│ 5 1  2  3  4  5││
││ 6  7  8  9 10│ │ 6  7  8  9 10││
││11 12 13 14 15│ │11 12 13 14 15││
││16 17 18 19 20│ │16 17 18 19 20││
││21 22 23 24 25│ │21 22 23 24 25││
│└──────────────┘ └──────────────┘│
└∊────────────────────────────────┘
      24 ⎕cr ((a b) (a b))
┌2──────────────────────────────────────────────────────────────────────┐
│┌2────────────────────────────────┐ ┌2────────────────────────────────┐│
││┌5─────────────┐ ┌14────────────┐│ │┌5─────────────┐ ┌14────────────┐││
││5 1  2  3  4  5│ 5 1  2  3  4  5││ │5 1  2  3  4  5│ 5 1  2  3  4  5│││
│││ 6  7  8  9 10│ │ 6  7  8  9 10││ ││ 6  7  8  9 10│ │ 6  7  8  9 10│││
│││11 12 13 14 15│ │11 12 13 14 15││ ││11 12 13 14 15│ │11 12 13 14 15│││
│││16 17 18 19 20│ │16 17 18 19 20││ ││16 17 18 19 20│ │16 17 18 19 20│││
│││21 22 23 24 25│ │21 22 23 24 25││ ││21 22 23 24 25│ │21 22 23 24 25│││
││└──────────────┘ └──────────────┘│ │└──────────────┘ └──────────────┘││
│└∊────────────────────────────────┘ └∊────────────────────────────────┘│
└∊∊─────────────────────────────────────────────────────────────────────┘
      ]boxing 24
Bad ]BOXING parameter 24 (valid values are: OFF, 2, 3, 4, 7, 8, and 9)


Is there a way you make thoses new QuadCR available in "]boxing' ?

Should say something like "
Bad ]BOXING parameter nn (valid values are: OFF, {2..4}, {7..9}, and {20..24})
" or something like that.

I'm actually reading the whole "apl2lrm.pdf", near half done. And thanks for pointing us to a dowbload site.
With "not as old document" as I used to have (mine was 1970) I can learn the therms and idea behind
the new apl's definitions!

Will also read the "is13751.pdf" and the "MasteringDialogAPL.pdf" ones too.

many, many, many thanks !

Xtian.




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

I have added axis lengths as suggested. *SVN 56**1*. 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]