« first day (2682 days earlier)      last day (22 days later) » 

10:53 AM
Small and nice problem:
An N×N matrix is valid if every column and row contains all integers from 1 to N.
Return true if the matrix is valid
My solution:
{∧/{(⍵[⍋⍵])≡⍳≢⍵}⍤1⊢⍵⍪⍉⍵}
any other ideas?
Making it tacit made it less readable by the way
Was triggered by this one because I saw only 15+ lines solutions in other languages
 
11:16 AM
∧⌿(⍋⍤⍋≡⊢)¨⍤(,⍥↓∘⍉⍨)
basically check if each wow and column is a permutation
oh, you had a good idea using Rank: ∧⌿(⍋⍤⍋≡⊢)⍤1⍤(⍪∘⍉⍨)
 
@Richard I believe ∧⌿⍳⍤≢∊⍤1⍪∘⍉⍨ does the trick, or ∧⌿⍋∊⍤1⍪∘⍉⍨ if you're golfing.
 
:)
 
I wrote that "in the blind". Does it work?
 
11:35 AM
would it not return a matrix, so you have to do reduce twice?
or do a ravel before
 
Ah yes, it should be ∧⌿⍤∊⍤1 rather than just ∊⍤1
Or yes, do ∧⌿⍤, instead of ∧⌿
Shortest (and fastest) would be ~0∊⍋∊⍤1⍪∘⍉⍨
 
is grade really faster than iota tally?
 
No, of course not. Fastest will be with ⍳⍤≢
Although, if N is reasonably small, and the matrix is actually valid, then the first column will only have unique small integers. They should be fast to grade.
 
 
4 hours later…
3:46 PM
tinyapl part 7: Quads, Key, Index released, and with it the latest version of TinyAPL, 0.4.1.0
@Adám cc for apl.news (thanks in advance!)
 
4:03 PM
@RubenVerg Done.
 

« first day (2682 days earlier)      last day (22 days later) »