« first day (1199 days earlier)      last day (1752 days later) » 

02:11
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.
Thanks. I'll keep on working on them and ask for feedback when the competition ends.
 
1 hour later…
03:33
Meanwhile, a pretty cool application of SVD 8415⌶ (and my 5400th bounty).
I didn't realize I already hit 5000 APL bounties in total.
03:45
@Bubbler Replace ×+ with ÷
Also, cool solution
 
1 hour later…
04:49
5
Q: Implement the Zundoko Kiyoshi function

sporeballBackground 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...

I was trying to solve this in APL. Here is my solution so far.
I'm almost done. But, I can't seem to find a way to express a lazy-evaluting if-else that prevents both arguments from being evaluated...
(∇A)/(~R) doesn't work, (A⍪∇A)[R] doesn't seem to work as well...
@Λ̸̸ APL (at least Dyalog's) doesn't have lazy evaluation at all.
You need to either use a guard in dfns {if_condition:then_expression⋄else_expression} or power operator f⍣(zero_or_one).
A better alternative would be append_a_random_number⍣array_ends_with_the_pattern; relevant Cultivation.
@Λ̸̸ Example
 
2 hours later…
RGS
RGS
07:10
@Bubbler I like this TIO link
What are the rules to jot several things together? Adam once told me I could look at dyadic f(jot)g as f with right argument preprocessed by g
So sometimes I think "I wanna do f and preprocess left arg with g" so I write g(jot)f only to realize it is not going to work like that
@RGS Yeah, that is particularly clunky to do in APL.
RGS
RGS
So how do multiple jots work..? Is there a nice rule or do you recommend experimentation?
Well, just apply the parsing rule.
@RGS From left to right.
RGS
RGS
@Adám L2R is the parsing rule?
@Bubbler you mean what Adám just said?
07:14
And remember that jot can do two (or three) different things, depending on the operands: f∘g, x∘g, g∘y
@RGS Well fn dop fn dop fn dop… is ((fn dop fn) dop fn) dop
RGS
RGS
@Bubbler with x or y I am kind of currying, right?
@mods Thank you all for reacting. We're quite low on mods here, so I tend ask a few places.
RGS
RGS
@Adám (what is going on? :O)
@RGS f and g are functions, x and y are arrays.
07:17
@RGS When a <20 SE rep user wants to chat here, I have to ask a mod to grant them access.
RGS
RGS
@Adám ok, I thought you could do it yourself
@RGS I've logged it as issue 18111.
RGS
RGS
@Bubbler so that's a yes, right?
Ah, now I get what you meant by "currying", yes.
RGS
RGS
@Adám cool, I hope my email was helpful enough
07:18
Sure. You could even have written "more→behind"
RGS
RGS
@Bubbler maybe I misused the word :P but I meant "apply one argument already" in a sense that turns a dyad into a monad
(f∘g∘x)⍵ → ((f∘g)∘x)⍵ → ⍵ f∘g x → ⍵ f g x
RGS
RGS
@Adám I think there's a joke to be understood there but I didn't get it :) probably because I never used ->
@RGS That'd be f⍨∘g⍨ which is why I think we should have for exactly that.
@RGS Ah, that's "go to".
RGS
RGS
@Bubbler I see
@Adám so can a "fn" here be an array?
07:22
@RGS Yes, an fn there can be an array.
RGS
RGS
@Adám yup, a glyph would be better than all those tildes
@RGS You can roll your own: Ⓞ←{(⍺⍺ ⍺)⍵⍵ ⍵}
RGS
RGS
So to start off, is this correct? +°3°÷°×°2 w = ((((+°3)°÷)°×)°2) w = w (((+°3)°÷)°×) 2
Your jot looks like a degree symbol. Other than that, yes.
RGS
RGS
@Adám that's because my android keyboard doesn't have APL glyphs :-P
BUT it does have things like π÷×√
07:27
@RGS Btw, you need to separate 2 and w
Parsing is correct, though it will error with every possible input
because it will be calling +∘3 dyadically.
RGS
RGS
@Adám because of stranding, right; but I meant for a right tack |- to be there, yes
OK.
RGS
RGS
@Bubbler hm that is annoying :) so I guess there aren't many sensible ways of jotting lots os fns and slipping arrays in the middle there..?
@RGS You will just need some parens: X+∘(÷∘2)Y is X+Y÷2
RGS
RGS
07:31
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
Yup.
Another way to state it is that ⍵ (((+∘3)∘÷)∘×) 2 becomes ⍵ (+∘3) ÷ × 2
RGS
RGS
@Adám is the weird spacing just on my phone? But I included many more parens than were needed just to force the order of execution upon me
No, I added those spaces because:
⍵ (((+∘3)∘÷)∘×) 2
⍵   (+∘3) ÷  ×  2
I think this is the reason for the, often odd-seeming, definition of f∘g.
RGS
RGS
In what sense?
I don't think the jot is defined in a weird way... At least for the more standard cases, like f°g w
@RGS This or this may interest you.
RGS
RGS
07:38
@Adám I tried your language bar because I was aware of its existence and I haven't managed to get it to work
@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.
@RGS Hm :-(
RGS
RGS
@Adám I see, then I was also confused by dyadic f°g but the "preprocess on the right" explanation set it straight for me
@RGS it's a symmetric character, but its behavior is all but that (besides the looks, which Adám showed there).
RGS
RGS
@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)
I wonder why that doesn't work.
RGS
RGS
07:41
@Adám I'll have a look at dzaima's keyboard
@Adám is document defined out of thin air? Don't you have to get an explicit reference to the doc?
@RGS that's JavaScript.
@RGS document is the root object.
RGS
RGS
Hm, just wondering there...
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
There's also this app which is easier to install, it being on the Play store.
@Adám i got it to appear with a userscript, so the problem is somewhere around the bookmark part
RGS
RGS
07:50
@dzaima on mobile or pc? Pasting the code directly into the address bar attempts a Google search on my mobile
@RGS on mobile, Firefox, Tampermonkey
@user766955 Hi Conor, and welcome to the APL Orchard!
@RGS Add a bookmark, change its address to the javascript:... code, and click the bookmark.
I'd love to attend these but it is too late at night for me in London.
RGS
RGS
08:15
@Bubbler that was what I already did and it didn't work; nothing happens
@Adám wasn't that supposed to open an APL keyboard inside the app? It only shows a text area! I'm so confused :-P
@RGS you have to enable & change the layout in settings
RGS
RGS
@dzaima yup got there! Thanks
⋄×⋄⍝⊃⊆⊃↓≥≠∇→&-!÷○⍵∇≤≡≠≡≠<⍲>⍬⌷¯∆≤≡≤
it works
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)
RGS
RGS
Ugh now i cant switch back xD
@RGS having the keyboard open should add a notification to change it directly
RGS
RGS
08:23
@dzaima thank you for being my saviour
RGS
RGS
Are you related to the Dev team of this keyboard?
The format string has a bug there
@RGS not related to either. I just forked an open source one
08:41
@RGS I'll tell the dev.
RGS
RGS
@Adám ok thanks; is it James Heslip? Or someone who works with him? Also, do you know everyone in the APL world? :-P
I don't know everyone, but I happen to know that this is @Gil.
@dzaima You know this Android Java stuff. Maybe you can even fix it ^ ?
@Adám hmm
That could just be it.
One thing that worries me is that the Play store says "Updated September 3, 2018" but the gitHub repos have been dormant for 6 years.
@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
Gil
Gil
09:07
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.
@RGS ^
RGS
RGS
@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 :)
Gil
Gil
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"
09:23
@Gil i don't know where RGS got that, haven't seen it either
@Gil seems it appears in GBoard after holding spacebar
Gil
Gil
@dzaima OK, well I'm happy to accept PRs, but right now it's not very far up my todo list I'm afraid.
One of those projects that I barely touch, so takes a bit of time to get my head in gear if you know what I mean
RGS
RGS
(I, for sure, know what you mean and tbh I am not terribly worried about this bug; I just wanted to let the right people know.)
Gil
Gil
@RGS Thanks!
ah, a .idea folder, maybe IntelliJ will compile without complaining too much about hardcoded stuff
10:22
@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?)
 
2 hours later…
12:03
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 >.<
@JoKing you have like 3 months, i think you can manage
@dzaima Yes, but now I'm distracted doing it instead of studying
@JoKing ok that's very much understandable. though my problem is i'm more doing neither :p
 
5 hours later…
17:22
@user766955 Hi jitwit. If you want to participate here, email adam@ with the same domain as www.dyalog.com
18:21
@user767535 Oops, the above message was for you ^
18:36
Hello APL-ers!
My first question.
Is there a way to check 1 2 3 = 1 2 3 4 5 for only the length of the shorter array without doing 3↑
Also, how come i am user766955 instead of code_report?
@user766955 what output are you expecting in this case?
1 (true)
@user766955 In which case, you can use the match function: 1 2 3≡1 2 3 4 5
right, sorry match is what I wanted
Hi,so, here i can ask about some doubts? its about batch files.
18:43
that will return 0 though
Ah sorry, I misread your question
@JamesHeslip I basically have some code like this: {(≢⍵)↑⍺≡⍵} and I would like to avoid the tally omega take
a sort of "lazy" match
maybe it doesn't exist
I have something, but I'm struggling to see if this will work for all cases
(1 2)(∪≡⊢)(1 2 3 4 5)
(1 2 3)(∪≡⊢)(1 2 3 4 5)
1
(1 2 2)(∪≡⊢)(1 2 3 4 5)
0
(1 2 4)(∪≡⊢)(1 2 3 4 5)
0
is this a train? i don't really underatnd (a b c) notation very well
Yes. Are you more familiar with dfns?
18:48
yes, just {..} right?
It could be rewritten as {(⍺∪⍵)≡(⍺⊢⍵)}
or {(⍺∪⍵)≡⍵} for simiplicity
oh right, the avg example
"avg example"?
avg ← +/ ÷ ≢
Right. Here we apply {(+/⍵)÷(≢⍵)}.
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?"
18:52
interesting, trains + tacks equals way more possibilities
Well, not really. There is nothing you can do with a train that you couldn't do with a dfn, or a traditional function really.
That I'm aware of*
well what i meant was that i always thought trains were quite limitted
@user766955 Because you are new. After a while, it'll switch.
cause you have to fit a certain "pattern"
tacks let you change that pattern
@JamesHeslip There's very little you can only do with a train/derived function.
@user766955 and parens can also help change that pattern.
@DavidPostill Can you give @user767535 write access?
18:55
@Adám I was under the impression that you could convert most functions to a tacit style?
@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.
@JamesHeslip this fails: (2 1 2)(∪≡⊢)(2 1 2 1)
@user766955 is the set union. Not what you want.
Ah, quite right. Note to self: use more test cases...
@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.
19:03
@Adám What's their full userid?
@Adám that is neat to know
@Adám Won't let me do it. Meta.se is a different chat server. He needs to have an account somewhere else.
@Adám Done.
19:10
Hi, thanks for having me!
@user767535 Welcome! I'll be gone now for 26 hours, but feel free to ping me (@Adám) as much as you want and I'll respond when I get back.
@user766955 Does your lazy match need to start at the beginning of the array, or could the result merely exist in both?
has to start at the beginning
In which case: 1 2 3 4{⊃⍺⍷⍵}1 2 3 4 5
it would be easier if it were just a subarray
19:13
@JamesHeslip I was just about to say that. Also 1 2 3(⊃⍷)1 2 3 4 5 of course.
@IgorBoldt Hi there. Interested in APL?
@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..."
@user766955 APLcart may interest you.
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?
@Adám can you elaborate on (⊃⍷) what this expands to? is the a train or a fork or something?
19:29
nevermind about the first!
19:59
@user766955 it will expand to {⊃⍺⍷⍵}
It's an atop.
@user767535 ]box on
@voidhawk was using ]display. this is better, thanks
 
3 hours later…
22:43
Is there something like J's under (&.)?
23:00
@jitwit - I'm not familiar with J; what does Under &. do?
23:16
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.
23:36
Yeah, (f &. g) is more or less (g⍣¯1 ⋄ f ⋄ g) mod some rank specifics. Eagerly awaiting 18 haha, that looks pretty hairy. thanks!

« first day (1199 days earlier)      last day (1752 days later) »