11:12 AM
Dyalog are attending the FinnAPL Forest Seminar - taking place at Hämeenkylä Manor, Vantaa, Finland on 15-16 March. For details go to http://www.finnapl.fi/tapahtu.htm

2 hours later…
1:33 PM
@Adám when shaping a matrix as 3 3⍴values, is 3 3 = ≡mat ≢mat? Or is it the other way around? Or is it not that at all? :p

@J.Sallé 3 3 would be ⍴mat. ≢mat is the number of major cells (3). ≡mat is the depth (1):

@Adám ah, naturally. Makes sense. Thanks

⎕←mat←3 3⍴⎕A ⋄ ⎕←⍴mat ⋄ ⎕←≢mat ⋄ ⎕←≡mat

ABC
DEF
GHI
3 3
3
1

Yup, that solves it
The function doesn't work without the (⍴⍵)⍴

1:45 PM
@J.Sallé Really‽

@Adám hur dur, I left the last there
I used it because I was getting a rank error when doing {^/∊⍵=1 ¯1×⍉⍵}, and I didn't try using (⊂1 ¯1) by itself
Just thought I had to shape it before using or I'd always get a rank error

@J.Sallé You want to multiply the entire array 1 ¯1 with each element of ⍉⍵ so write that! (∘×¨)

@Adám aaaaah, cool! I actually tried to use ×.¨ and it didn't work, obviously

1:52 PM
@EriktheOutgolfer Yeah, sorry, that's what I meant (as ¨ is a monadic operator).

Yeah I still get mixed up with using . and

@J.Sallé . is just for inner/outer product (and namespaces and decimals — ugh, it's so overloaded).

@J.Sallé ∘. is a different syntax element altogether, in that it only takes a right operand, but otherwise it acts like an operator...yeah, that's confusing at first, but you can also think of . taking a left operand that can either be a function or , where in the latter case it acts as outer product using the right operand

@EriktheOutgolfer Or just think of ∘.f as syntactic sugar for f⍤0 15.

1:57 PM
Okay I'll try going tacit now, wish me luck :p

@Adám yeah, like prefixing a function with ∘. being the same as prepending ( and appending ⍤0 15)
oh, and one last thing, +.∘.- is a syntax error >_>

@EriktheOutgolfer Of course. Operators are left-associative, so +.∘.- is (+.∘).-:
⎕←+.∘.-

.
┌┴┐
. -
┌┴┐
+ ∘

@Adám I feel like ∘. syntax should have a higher priority than operator syntax

@EriktheOutgolfer Yeah, I've suggested that too.
@EriktheOutgolfer +.-⍤0 15 doesn't give you what you want either. You'd need +.(-⍤0 15) just like +.(∘.-).

2:07 PM
@Adám I recall having seen somewhere a little "conversion table" from Dfns to Tacit functions, do you know what I'm talking about?

@Adám but I feel like ∘. should do the parenthesizing automatically

I don't know if I've seen it here or in one of the resources you posted. Can't seem to find it

2:20 PM
@EriktheOutgolfer If ∘.f was f\ would you expect +.-\ to be +.(∘.-) or ∘.(+.-) ?

The problem I'm having now is that I can't seem to use the original matrix as the left argument for the , should I assign it to a variable or can I do without it if I'm smart enough?

@Adám That yields 2 for some reason. The fn I have is ⊢≡1 ¯1∘×¨⍉⊢
1 ¯1∘×¨⍉⊢ gives me the transposed and negated matrix
I just need to match that to the original one now

2:24 PM
@J.Sallé why do you use dyadic ?

@EriktheOutgolfer I'm not? I think >.>

@J.Sallé then why are you forking with it in the center?

That gives me the exact same result as the one in my Dfn without the

1 ¯1∘×¨⍉⊢ means (1 ¯1∘×¨)(⍉)(⊢)
@J.Sallé X(f g h)Y is the same as (X f Y)g X h Y
(f g h)Y is the same as (f Y)g(h Y)
so (1 ¯1∘×¨⍉⊢)X is the same as (1 ¯1∘×¨X)⍉⊢X

I think that might be enough to help me
I suck at visualizing these kinds of things tbqh, that's probably why I couldn't learn calculus for the life of me

2:34 PM
@J.Sallé Use the boxed display to visualise for you:
⎕←⊢≡1 ¯1∘×¨⍉⊢

┌─┼───┐
⊢ ≡ ┌─┼─┐
¨ ⍉ ⊢
┌─┘
∘
┌─┴──┐
1·¯1 ×

2:49 PM
I got as far as ⊢≡⍨1 ¯1∘×¨(⍉⊢)
But that seems to use the transposed/negated matrix as the argument, not the original one
⎕←⊢≡⍨1 ¯1∘×¨(⍉⊢)

@J.Sallé
┌──┴──┐
⊢ ┌───┼──┐
⍨   ¨ ┌┴┐
┌─┘ ┌─┘ ⍉ ⊢
≡   ∘
┌─┴──┐
1·¯1 ×

3:00 PM
@J.Sallé Hint: Note that the order of flipping and negating is irrelevant, so you may negate first, and flip afterwards.
@J.Sallé Alternative hint: Operators are left-associative.
@J.Sallé Btw, ≡⍨ is the same as .

Okay I'm getting somewhere I think

@J.Sallé One more hint. A≡⍉B(⍉A)≡B.
@ngn OK, fine, ≡⍨ isn't always the same as , but for J.Sallé's purposes, it is.

@Adám see my problem is that I only see B in this case ⍨

@J.Sallé No, A is and B is 1 ¯1∘×¨

3:08 PM
@EriktheOutgolfer or he might have been trying to predict my thoughts :) though I wouldn't argue over that

@EriktheOutgolfer ^

@Adám ...that's like saying "you'll be pedantic now and I know it", no?

CMC: Shortest possible expression showing that is not the same as ≡⍨.
@EriktheOutgolfer Yup.

@Adám ngn being ngn now: why is that not obvious, why is it important and what are you trying to divert our attention from? :)

@ngn Not obvious to someone who thinks symbolically instead of numerically (with limited precision), not important (just a fun challenge made for you), nothing.

3:15 PM
lol that would be very trivial since lesson 1

@ngn Yes, of course.

@Adám ok, it's not obvious (to me) then

@Adám that changes like the whole CMC a few levels of magnitude

I think my brain is gonna shut down soon if I can't solve this ⍨
Only way I managed to use dyadic was (⊢⍉)≡1 ¯1∘×¨

3:19 PM
@EriktheOutgolfer The whole thing started with J.Sallé needing to compare two matrices.

and that still gives me 2

@J.Sallé Ah, you're forgetting to apply it with parens!

@Adám I literally just did that facepalm

@Adám but...but I could've abused something like (≡1)≢(≡⍨1)
but since we must assume the is not monadic ≡, oh well

@J.Sallé Now you just need to simplify one more thing.

3:22 PM
@Adám I assume I can remove those parens at (⊢⍉)

@J.Sallé Yes, and ⊢AA.

Good god that was hard
Finally got (⍉≡1 ¯1∘×¨) though

@J.Sallé practice and you'll get it sometime :)

@J.Sallé I have not come up with a shorter one.
If APL had J's j. function Ⓙ←⊣+0j1×⊢ it would be just (+≡⍉)Ⓙ/¨

3:30 PM
(and of course ngn's strongest weapon is cumulative reduce, as we can see here)

@ngn Wait, does that always hold?

@Adám I don't know, I haven't even copied the tests yet

@ngn Obscure (and longer than J.Sallé's): ⊂¨∘⍉≡,∘-/¨

@Adám well, 1 ¯1×A B is the same as (1×A)(¯1×B) -> A(-B) and ⊢∘-\A B is the same as A(A⊢-B) and therefore A(-B), so...

@EriktheOutgolfer Sure, but you need to do that on every element.

3:33 PM
@EriktheOutgolfer f←⍉≡ ⊢∘-\¨ fails the last test case apparently

(There's a space there I hadn't noticed but it makes no difference)
@Adám oh duh. It wasn't failing for the other function so I didn't notice

@ngn So yes, ⍉≡⊢∘-\¨ is right.

⎕←⍉≡⊢∘-\¨

@J.Sallé
┌─┼─┐
⍉ ≡ ¨
┌─┘
\
┌─┘
∘
┌┴┐
⊢ -

3:39 PM
Just to clarify here, the \ is replicating ⊢∘- into the argument?

@J.Sallé No, it is a cumulative ⊢∘-/. But since there are only two terms, Re Im, it is Re (Re⊢∘-Im).

@J.Sallé that's the issue with hybrids :P

@EriktheOutgolfer Well, there's no issue here, other than slight obscurity.

I'm just finding it hard to work out an explanation. I'll post it and you can check it for me @Adám?

3:42 PM

@J.Sallé Sure, or maybe @ngn?

Yeah, anyone who knows better than me :p

@EriktheOutgolfer Right, schizos prefer to be operators if at all possible, so ⊣/∘⊢⌽ is (⊣/)∘⊢⌽

@J.Sallé Repeat the first element and negate the secondIgnore the first element in favour of the negated second element or something.

3:47 PM
@Adám that's what I was gonna say too, the only purpose of ⊢∘ is to force - to be monadic

good luck explaining ngn's cumulative reduces, they're just so packed together :D
5

@J.Sallé Maybe you meant to imply that the original left is also returned?

@Adám yeah, that's what I meant actually, but I see how the wording is off

@J.Sallé Maybe "scan" isn't descriptive enough. Cumulative reduction using… ?

⍉≡⊢∘-\¨ ⍝ Anonymous tacit function.
¨ ⍝ To each element of the argument:
\  ⍝ Cumulative reduction, using
⊢∘-   ⍝ Ignore the first element, then negate the second
≡      ⍝ And match
⍉       ⍝ To the argument's transposition.

3:50 PM
this is so boring, someone should create an auto-explainer for apl

seems like a np-complete problem

@ngn Not really possible, as explanations include references to what the data stands for.

sure, it's just that we need to train it to recognize ngn's cumulative reduce ab clever uses :P

would probably be possible if every squiggle was only a single operation every time

@EriktheOutgolfer there's nothing wrong with using scan :)

3:52 PM
@ngn lol where did I say that

@EriktheOutgolfer reduce in apl is bad, but scan is ok
@EriktheOutgolfer you didn't say it but you thought it :)

@ngn there is when you use it to do sorcery such as that ಠ__ಠ

@ngn well yeah, since most challenges asking for specific reduces reduce from left-to-right

@EriktheOutgolfer I think it should have been left-to-right, like array indices go, not right-to-left like functions do
@EriktheOutgolfer and the thing with the required ⊃ after reduction is a bit annoying, but at least it's consistent with the rest of apl

@ngn maybe in the early 60s people thought differently :P
@J.Sallé remember this is , where even the worst abuses ever are allowed and even encouraged ;)

3:56 PM
@ngn -/ and ÷/ are only interesting RTL.

@EriktheOutgolfer black magic though D:

4:31 PM

4:54 PM