bug-apl
[Top][All Lists]
Advanced

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

Re: APL Christmas 2020 doodle: Tree


From: Hans-Peter Sorge
Subject: Re: APL Christmas 2020 doodle: Tree
Date: Fri, 25 Dec 2020 22:14:21 +0100
User-agent: Mozilla/5.0 (X11; Linux x86_64; rv:78.0) Gecko/20100101 Thunderbird/78.5.0

Hi,

in GNU APL  monadic ↑ takes the first element ( that is of a vector or higher ranking matrix, try ↑ 3 3 3 ⍴'abc' 'cde').
As the resulting vector has three elements you end up replicating them 9, 2, 9 times ( 9 2 9 / 'abc').

So there is no application of the replication vector 9 2 9 to all of the right elements.
Side note 9 2 9 / 'abc' 'def' 'xyz' is an element wise replication as left and right vectors are of same length.
Try each: 9 2 9 /¨ 'abc' 'def' . The left argument is being applied to each right vector.

Using monadic ⊃ you end up disclosing a vector of vectors resulting in a matrix.
 ⊃'abc' 'def'
abc
def

Using 9 2 9 / ⊃'abc' 'def' will replicate the matrix column wise.
That is the same effect as with  ⊃ 9 2 9 /¨ 'abc' 'def' .

Best Regards
Hans-Peter






Am 24.12.20 um 09:08 schrieb Russtopia:
Thank you so much for a rapid answer. With no background into the history of the language, I would not have known where to look for this sort of thing.

I see now in Dyalog's "Mastering Dyalog APL, 1st Ed.", ~p372 "Specialists Section" there are discussions about this and related language differences.
There are a few items to digest there in regards to their ⎕ML System Variable and how it handles APL2 (IBM) vs. Dyalog APL dialects.

The more I explore, the more I question whether I must choose to study "the APL2 path" or "the Dyalog APL path" ... :) I hope I do not have to choose!
So far, trying both dialects while learning has illuminated some concepts for me, but I fear I might confuse myself with implementation differences.

Again, thank you very much for the insight.
-Russ


On Wed, 23 Dec 2020 at 23:21, Kacper Gutowski <mwgamera@gmail.com> wrote:
On Wed, Dec 23, 2020 at 10:46:13PM -0800, Russtopia wrote:
> [Dyalog]
> 9 2 9/↑'∘⌹∘' ' ⌹ '
> ∘∘∘∘∘∘∘∘∘⌹⌹∘∘∘∘∘∘∘∘∘
>          ⌹⌹
>
> [GNU]
> 9 2 9/↑'∘⌹∘' ' ⌹ '
> ∘∘∘∘∘∘∘∘∘⌹⌹∘∘∘∘∘∘∘∘∘
>
> Is it unexpected that GNU APL does not apply the Compress (/) across
> multiple right-hand items?

There are some subtle differences in how / works in Dyalog and in GNU APL,
but here the reason is much more prosaic.

By default the monadic ↑ and ⊃ are swapped in Dyalog.  It has a setting
called ⎕ML that controls it, and if you set ⎕ML←2, it will interpret
this _expression_ the same way GNU APL does:

       9 2 9/⊃'∘⌹∘' ' ⌹ '
∘∘∘∘∘∘∘∘∘⌹⌹∘∘∘∘∘∘∘∘∘
          ⌹⌹         


-k


reply via email to

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