## /.//2 2

**Forum rules**

This forum is for discussing APL-related issues. If you think that the subject is off-topic, then the Chat forum is probably a better place for your thoughts !

1 post
• Page

**1**of**1**### /.//2 2

What should be the depth of a←/.//2 2? The question arrived in my in-box first thing in the morning. I responded as follows (lightly edited).

This is in the class of “what should it be” rather than something that urgently needs to be fixed, because I do not (can not) believe anybody is depending on the result. OK, fools rush in where angels fear to tread:

To figure out a←/.//2 2, we note that the two leftmost / are the replicate function and the rightmost / is reduction. That is, the expression should be equivalent to a←{⍺/⍵}.{⍺/⍵}/2 2. We have to figure out f/ and f.g.

f/, reduction, is defined as:

(A previous version of this text used an erroneous definition of reduction:

Therefore,

(Following [Iverson 1980], a proof consists of a list of expressions, each equivalent to its predecessor and annotated by evidence for the equivalence.)

Now we have to figure out what 2 {⍺/⍵}.{⍺/⍵} 2 is supposed to do. f.g, inner product, is defined as follows on vectors (or scalars).

(Note: Inner product in Dyalog APL extends the the definition in ISO/IEC 13751:2001(E), page 121, which says v0 f.g v1 ↔ f/ v0 g v1. NARS2000 uses the same definition as Dyalog APL.)

Therefore,

And what is ≡ ⊂ ⊂ 2 2 ? In Dyalog APL 17.1.35506.0 and also 16.0.33755.0:

Therefore, the depth of a←/.//2 2 is 3. Should be 3.

I am gonna have my breakfast now. I feel that I’ve earned it.☺

This is in the class of “what should it be” rather than something that urgently needs to be fixed, because I do not (can not) believe anybody is depending on the result. OK, fools rush in where angels fear to tread:

To figure out a←/.//2 2, we note that the two leftmost / are the replicate function and the rightmost / is reduction. That is, the expression should be equivalent to a←{⍺/⍵}.{⍺/⍵}/2 2. We have to figure out f/ and f.g.

f/, reduction, is defined as:

f/vec ←→ ⊂ (0⊃vec) f (1⊃vec) f … f ((¯1+≢vec)⊃vec) when 1<≢vec.

(A previous version of this text used an erroneous definition of reduction:

f/vec ←→ (0⊃vec) f¨ (1⊃vec) f¨ … f¨ ((¯1+≢vec)⊃vec) when 1<≢vec.The erroneous definition does not change the conclusion but does require changes to some steps in the proof.)

Therefore,

⍝

/.//2 2

{⍺/⍵}.{⍺/⍵}/2 2 ⍝ assumption about / as hybrid

⊂ (0⊃2 2) ({⍺/⍵}.{⍺/⍵}) (1⊃2 2) ⍝ definition of f/

⊂ 2 ({⍺/⍵}.{⍺/⍵}) 2 ⍝ ⊃

(Following [Iverson 1980], a proof consists of a list of expressions, each equivalent to its predecessor and annotated by evidence for the equivalence.)

Now we have to figure out what 2 {⍺/⍵}.{⍺/⍵} 2 is supposed to do. f.g, inner product, is defined as follows on vectors (or scalars).

v0 f.g v1 ←→ f/ v0 g¨ v1

(Note: Inner product in Dyalog APL extends the the definition in ISO/IEC 13751:2001(E), page 121, which says v0 f.g v1 ↔ f/ v0 g v1. NARS2000 uses the same definition as Dyalog APL.)

Therefore,

⍝

/.//2 2

⊂ 2 {⍺/⍵}.{⍺/⍵} 2 ⍝ continued from above

⊂ {⍺/⍵}/ 2 {⍺/⍵}¨ 2 ⍝ definition of f.g

⊂ {⍺/⍵}/ ⊂ 2{⍺/⍵}2 ⍝ ¨

⊂ {⍺/⍵}/ ⊂ 2 2 ⍝ /

⊂ ⊂ 2 2 ⍝ reduction on a single

And what is ≡ ⊂ ⊂ 2 2 ? In Dyalog APL 17.1.35506.0 and also 16.0.33755.0:

≡ ⊂ ⊂ 2 2

3

Therefore, the depth of a←/.//2 2 is 3. Should be 3.

I am gonna have my breakfast now. I feel that I’ve earned it.☺

- Roger|Dyalog
**Posts:**207**Joined:**Thu Jul 28, 2011 10:53 am

1 post
• Page

**1**of**1**### Who is online

Users browsing this forum: No registered users and 1 guest

Powered by phpBB © 2000, 2002, 2005, 2007 phpBB Group