Is it ok to ask how to improve an answer to the Phase I of problems of the APL problem solving competion here? To be clear, the code already achieves its purpose but I'm looking for feedback on how to improve it.
> Until after the competition has closed, do not post your (partial) solutions online, nor seek help from services that provide peer review. We monitor various sites, and reserve the right to disqualify or penalize you for doing so.
Background
The Zundoko Kiyoshi function originates from this tweet by kumiromilk. Translated from Japanese, it reads roughly as follows:
The test for my Java lecture had a problem that said "Implement and describe your own function". I made it continuously output either "zun" or "doko" rando...
But for the sake of my understanding I'll keep going w (((+°3)°÷)°×) 2 becomes w ((+°3)°÷) (×2) which becomes w (+°3) (÷(×2)) which now errors like the prophecy once said
@RGS Right, but people get used to the monadic form f∘g meaning "atop", i.e. apply f to the result of g. Then they mistake the dyadic form, thinking it also applies f on the result of g, but it doesn't.
@Adám for reference, the URL in my bookmark is javascript:(d=>{let e=d.createElement("script");e.src="https://abrudz.github.io/lb/lb.js";d.body.appendChild(e)})(document)
Changing it to javascript:(d=>{alert("ui");let e=d.createElement("script");e.src="https://abrudz.github.io/lb/lb.js";d.body.appendChild(e)})(document) didn't show an alert popup
it's (as with my app) a global keyboard change which may not be optimal (i made mine because switching keyboards is a lot of work and i was already using hacker's keyboard)
@dzaima yeah, seems that is used here which doesn't expect any %ses. i don't remember how i compiled hacker's keyboard, so have no idea how would i test this though
Hi there Thanks for the heads up on this. I haven't been developing it actively as you point out. I had to do something a couple of years back, but looks like I never pushed the changes. I'll take a look now.
@Adám I see it; @Gil I can share whatever specs you need with you if the bug is a really weird one; hopefully dzaima already figured out what is going wrong :)
I've just pushed the local changes I had made, so the code should now match what is available on Play.
@dzaima I'm not sure how this works, I hacked this IME from another project many years ago now. I've not noticed the issue on my Samsung phones. Even now it says "English (United Kingdom)" where yours says "%s"
@dzaima @Gil it indeed did not (after commenting everything about release builds), and indeed changing that %s fixed the %s. Though to note is that the %s also controls the subtext in the "manage keyboards" settings screen, previously showing "English (United Kingdom)" (so it does use the %s - is this a problem in GBoards dialog?)
I was just coming in here to ask when the 2020 APL competition was opening when I saw Adam's starred message. Now I just wish I didn't have exams right now >.<
It's stylistic- I find trains can be good in small doses, but often times I find myself running away thinking "ooh, how could I convert this to a train?"
@JamesHeslip I guess APL functions enumerable… See "Restrictions and Extensions" here for what cannot be converted to tacit. However, I said there's very little you cannot convert to explicit.
@user766955 I watched your video on counting negative numbers in a matrix. I have a comment on your APL code there. While idiomatic enough, you can improve performance a lot by making your code more machine sympathetic: You used {+/0>,⍵}. Now ⍵ and mat point to the same array (ref-count=2), so when you ravel (,) it cannot be done in-place (just changing the shape) because the original array is still needed.
If instead you use {+/,0>⍵} then we first create a Boolean matrix which, since APL uses packed bit-Booleans, uses only one eights of RAM. Then since this Boolean matrix has ref-count=1, the ravel can be done in-place, simply changing the shape and avoiding a full memory copy.
@Adám I never think of ⍷ unless dealing with text. This simple problem got me thinking about "oh, I could change base..." or "if I take one from the other and make sure I've got zeroes except for the overflow..."
Two brief questions. I'm having trouble getting boxes to display in my local dyalog session (macos), how can this be done? Also, what would be some recommended resource to pick up Dyalog APL given some J knowledge?
OK, after checking the J vocabulary page, if I'm understanding it correctly, it looks like there will be a primitive for it in Dyalog 18.0; in 17.x, it's X f{⍺←{⍵ ⋄ ⍺⍺} ⋄ ⍺⍺⍣¯1⊢(⍵⍵ ⍺)⍺⍺(⍵⍵ ⍵)}g Y, where f and g are the functions to apply, X and Y are the arguments to apply them to, and explaining the stuff in {} gets a little complicated, but basically says how to do it.