The APL Orchard

apl.chat ― Learn, teach, ask, code, golf, & discuss usage. See ...
Oct 23 12:07
don't forget the 2∊⍵ instead of ∨/2=⍵!
Oct 23 11:30
oh that can actually be one char shorter: (2|t)⊣@t(2|t)@t
Oct 23 11:26
re making it more array-ish: you could generate the neighbours of each block and then check each pair of neighbours for each type of block, something like:

`{⍸(2|t)⊣@t⊢2∊¨@o(~2|+/)¨@z↓{⍵[0 2]}⌺3⊢⍵⊣z o t←⍸¨↓⍉⍵∘.=⍳3}`

but this is longer and only vaguely more array-ish
Oct 23 11:23
re golfing: you can change ⍵) (∨/2=⍵) 0[ to ⍵)(2∊⍵)0[ which knocks off a few chars
Aug 14 17:44
@xpqz I've thought quite a lot in the past about making something like this. I think sparse matrices may be the path forward with it, that way we could keep some of elegance of the transitive closure idiom ((∨.∧⍨∨⊢)⍣≡) and algorithms like it, without the quadratic complexity
Aug 14 14:54
@xpqz Thank you! You can kind of use this representation for graphs. You'd have to store a vector of 'parents' for each node, at which point you have a kind of backwards adjacency list. If I have the opportunity I'd like to make a similar resource for graphs as well :)
Aug 14 10:17
I have been working on a tutorial for working with trees, aimed at late-beginner/early-intermediate APLers. hopefully some people here find it helpful! constructive feedback is also appreciated