« first day (2438 days earlier)      last day (209 days later) » 

4:25 AM
@Jonah No, and I don't see how that would work or even help. When array notation becomes native, you'll be able to write (⍪2 2) as [2⋄2] which I guess is slightly nicer.
@Jonah I would probably just reshape to two columns, as it is a less heavy-feeling operation, but currently quite awkward. I have a proposal to be able to write ¯1 2⍴ or something like that (the actual value ¯1 isn't settled) to reshape into two columns.
 
 
5 hours later…
9:10 AM
There is a server issue with the APL Wiki that I am unable to do anything about. Sorry for the inconvenience. It is unclear when it will be back up, current estimate perhaps a few hours.
 
 
6 hours later…
3:00 PM
Welcome to APL Quest 2021-7! Today's quest is Can You Feel the Magic?:
> Write a function to test whether an array is a magic square. The function must:
> • have a right argument that is a square matrix of integers (not necessarily all positive integers)
> • return 1 if the sums of the numbers in each row, each column, and both main diagonals are the same, otherwise return 0
 
(∧/(+/1 1∘⍉)=+/,+⌿,(+/1 1∘⍉⍤⌽))
 
Yup, that's very straight-forward. Nice.
Have you considered collecting all the rows/columns/diagonals before summing?
 
no. Good one
 
{1=≢∪+/⍵⍪(⍉⍵)⍪↑1 1∘⍉¨⍵(⌽⍵)}
 
That's nice but how about using instead of ¨?
{1=≢∪+/⍵}⊢⍪⍉⍪⊢↑⍤,⍥(⊂1 1∘⍉)⌽
 
3:11 PM
(1=≢∘∪)(+/¨(⊂1 1∘⍉⍤⌽),(⊂1 1∘⍉),,/,,⌿)
 
That's very nested. I had 1=∘≢∘∪1⊥1 1∘⍉,⍉,⊢,1 1∘⍉⍤⌽
I wonder if we can use to get original and transpose each with a diagonal. Not sure.
 
I had {1=≢∪+⌿⍵,⍥{⍵,1 1⍉⍵}⌽⍵}
 
@Finn I'm confused. doesn't it fail to check the transpose.
 
@Adám had to read the help page to understand 1 ⊥ on matrices
 
Today you learned!
      {⍵,⍥{⍵,1 1⍉⍵}⌽⍵}3 3⍴⍳9
1 2 3 1 3 2 1 3
4 5 6 5 6 5 4 5
7 8 9 9 9 8 7 7
@Finn Look ↑. When you sum vertically, you get 1 4 7 twice, but never 1 2 3.
 
3:25 PM
@Adám 1=∘≢∘∪1⊥⊢,⍥(⊢,1 1∘⍉)⍉⍤⌽ ?
 
@rabbitgrowth Yes!
I think that's it, then. Any other ideas?
 
@Adám This feels like the non-dfn of what you had: 1≡∘≢⍉∪⍥(∪1⊥1 1∘⍉,⊢)⌽
 
@rabbitgrowth nice, and I can understand it
 
Somehow got it wrong trying to remember what I did. Still confused why my proposed solution passed the problem check.
`{1=≢∪+⌿⍵,⍥{⍵,1 1⍉⍵}⌽⍉⍵}` should be correct?
 
Yes, that's the explicit version of rabbitgrowth's.
 
3:32 PM
Is there any advantage between concatenating the original and the rotated square vs. concatenating a reversed and transposed square?
 
@Finn (btw, no markdown in multi-line msgs but if you use multiple messages in a row, they'll merge visually)
@mitchelljohnstone I don't think so.
Are we done?
 
@Adám I thought 1 1∘⍉,⍉,⊢,1 1∘⍉⍤⌽ was ordered in a strange way, then realized ⊢,⍉,1 1∘⍉,1 1∘⍉⍤⌽ wouldn't work
 
Right.
Anyway, next week is 2021-8: Time to Make a Difference, but two hours earlier by UTC.
 
Thanks Adám!
I think my main takeaway for the day is that if I'm using ¨ on two items, might be nicer
 
4:04 PM
@Adám early entry: |-⍥(0 24 60⊥¯3∘↑)
I think the earlier time might make it easier for me to make it actually
 
@Adám I guess adding the following testcase and its transpose should fix the issue with the problem checker, no?
↑(0 1 0 1 0)(0 1 0 1 0)(1 0 0 0 1)(0 1 0 1 0)(0 1 0 1 0)
 
 
2 hours later…
6:06 PM
@Adám That was my original approach, but it was much too long because I had to explicitly calculate the number of rows. Do you not think stencil improves on this? Also re: "you'll be able to write (⍪2 2) as [2⋄2]" can you show me the full phrase? When I simply sub in one for the other I get a syntax error.
 
 
1 hour later…
7:09 PM
Challenge seems to be over but 1=∘≢∘∪ is nice. I adapted that to my solution and got 1=∘≢∘∪1⊥⍉⍤⌽,⍥(⊢,1 1∘⍉)⊢
Also stole , instead of which I didn't realize you could do
 
7:39 PM
What's the most efficient way to reduce a Boolean matrix through AND? As in, if I have all 1s, it'll return 1, but any 0's would make the result 0?
@Jonah I was pretty similar but liked the code golf of using the transpose and rotate as arguments to the instead of the rotate and original. \o/
 
 
1 hour later…
8:52 PM
@mitchelljohnstone mmm, i like yours better too, i missed that before. re: your question my guess would be×/⍤,
actually guessing you meant in the context of the question specifically, in which case your 1≡∘≢ looks pretty good to me.
 
9:22 PM
@Jonah I was about in general / a different approach. I hadn't though of the multiplication, though. Thanks!
 

« first day (2438 days earlier)      last day (209 days later) »