This solution answers the question "assuming an infinite chess board, how many unique squares could the king travel to if he made only non-diagonal moves"
Basically a diamond, but solves the problem as directly as I could figure.
would also like feedback for solution to problem 11 in project euler https://tio.run/##ZVTLbtRAELzvV/SNLALiec8ckPgVw5rE0j7CeheColw4IEBZBAeUExe4cEDiAJG4ICTyJ/6RUNW2RCIsa9cz011dVd12fTS/O3tez1cHV1cya@uD/uW7k4nwWuOx330dFh0We/3rT/3uYnq7uheG3YN1O8NBh@PdDxzJv6vffZTuybZeN7KoN@v2eMioEW7FXJ53w/qhri3WcuMaTpvjDc4R8x5571ntBj6Om@VMNoeNMhmTNjVB98yDvX73s7qPoOkUP0PK43Y@H/OaGUPnjTxrN4dibnXy7LAB3erWyG1RH9OCs1f7/e6zvUGPUIMsRrWL7WL0bEXCJ6h8cXne775T2LQ/@4VCp2Pa0Xp1sG66rn3aMLzetKulPFrNt4tlJ/e1B6tlPR85rO8ADyXEX57vA@U6AS9Hq67VfIDOto8213JOxqT@7DfInP75ste/eQGA6R0@oLCYf49/vpnpkEu1a/nvGvSqUFk9lhomQsN2vukmEzmdtMujLYVnQS…
would also like to see how to golf it. couldn't seem to assign values inline when using @, and also in general with a multiline dfn
@nathanrogers first i tried doing the 4 directions (up-down, left-right, main diag, and alternative diag) separately
then i wondered if i could batch them together somehow. i noticed that padding with 0s is ok, as all numbers are positive, so a 0 product wouldn't affect the result
i noticed that the expressions that handle the 2 diagonals are similar, so i used { }¨ on the matrix and its ⌽
and finally i noticed that if i use the matrix and its rotation (⌽⍉) instead, i could save a few more bytes
"Does APL Need a Type System?"
At #FnConf18, Aaron Hsu talks about type theory and its applicability in the untyped APL world
https://confengine.com/functional-conf-2018/proposal/7712/does-apl-need-a-type-system
#FunctionalProgramming #APL #TypeSystem #TypeTheory #StaticallyTyped #DynamicallyTyped #DuckTyped #StronglyTyped #WeaklyTyped
@nathanrogers when a padding 0 is part of a 4-vector of adjacent numbers, the product of that vector will come out as 0, so it won't affect the maximum
> By relieving the brain of all unnecessary work, a good notation sets it free to concentrate on more advanced problems, and in effect increases the mental power of the race. A. N. Whitehead
It would seem that this notation in particular doesn't relieve any unnecessary work, instead it would seem to add additional cognitive parsing before intuiting the intent of the phrase.
It's like the phrase "The horse ran past the barn fell."
@dzaima Ah, but if you see a very long train, you can't see at a glance if the first function is applied monadically to the rest or is applied to the argument and then used as left argument to the next.
@nathanrogers well that's where I have to disagree. "Sum of omega, divided by length of omega" is much longer & doesn't explicitly say what it does, whereas "sum divided by length" is clear and to the point
@dzaima I think the main reason ∘ confuses is because the monadic form is an atop while the dyadic isn't. In other words, ⍺ f∘g ⍵ and f∘g ⍵ are usually not very related.
@nathanrogers Go here to install a browser language bar.
> Nevertheless, mathematical notation has serious deficiencies. In particular, it lacks universality, and must be interpreted differently according to the topic, according to the author, and even according to the immediate context
FWIW, I think it is valid to dislike functions behaving differently in different contexts (trains and not trains), but the conversation about parentheses and assignment is not really an argument.
@nathanrogers the difference is that all of those do the same thing in JS, but in APL trains vs dfns allow emphasizing different characteristics of the code
yeah I agree that the whole parenthesizing argument got a bit out of hand, but you said that trains requiring parentheses is strange and I couldn't just accept you saying that..
no, I wasn't saying that trains using parens is strange. I was saying that, inresponse to your complaint about (+/⍵) making thing less readable, I agree, but at the same time, you use parens in trains anyway, so that isn't really a valid comparison
the difference is that the train only has the outer parentheses, while the dfn has the outer brackets and parentheses inside too... if the train has too many parentheses, then what dzaima said is true ^^
that's where things got a little off. I wasn't complaining about parens, but that parens are illegible in regular dfns or in trains, so that didn't seem like a complaint
yeah I hate {}
I'd take any other kind of bracket than those. they make my eyes bleed in most editors with most color schemes