7:41 AM
my apl solution for reference @Bubbler tio.run/…
wait made a mistake, it should be `q←,`...

I don't have APL locally, and I'm not very good at APL performance either
Maybe @Adám can help

2 hours later…
9:51 AM
@Bubbler @Cowsquack What is the problem?

3 hours later…
12:56 PM
0

I want to reduce ⌿ several vectors/matrices at the same time. Here's my data: txt←(3 3⍴'a')(3 3⍴'b')(3 3⍴'c')(3 3⍴'d') b←(0 1 0)(1 1 1)(1 1 0)(0 0 0) Now, I want to reduce each matrix in txt by corresponding Boolean vector in b: b⌿¨txt Here's what I expect to get back: ┌───┬───┬───┬───┐...

1 hour later…
2:03 PM
@Adám my solution for advent of code 6 adventofcode.com/2018/day/6 is too slow
particularly 6a, which takes over 20 seconds to run
do you have any optimisation tricks/an approach that makes a better use of apl?

2:46 PM
@Cowsquack I'm not sure I understand the question right, but to me it looks like a `f⌺3 3⍣≡` where `f` gives the von Neumann neighbour char if unique. Then use `⌸` to count them. Disqualify letters that hit the edges. Pad the initial world with 8 empty worlds (for simplicity) to ensure no edge (pun intended) cases.

3:27 PM
@Adám takes a minute :(
I had tio.run/##SyzI0U2pTMzJT///v/…, then the remaining part (of removing letters hitting the edges) can be taken from my initial answer
but that is a neat solution except for the speed

@Cowsquack Side note: `(∊⍵)[2 4 5 6 8]:⊃q⋄5⊃∊⍵``n←(,⍵)[2 4 5 6 8]:⊃q⋄3⊃n` Probably won't speed things up much though.

2 hours later…
5:39 PM
@Cowsquack mine is this. It's not very APLy, but I'm pretty sure you could get the `¨` out of `M2`s generation if you tried hard enough

5:57 PM
nice, took <2s

argh if i had remembered about the nullifying of equal distance things I'd most likely be on the leaderboard. Now it's 20h later though :|

6:15 PM
@dzaima the last two lines can be simplified to `2⊃⌈⌿,∘≢⌸BAD~⍨∊M2`

@Cowsquack the `M2` generation is the slowest thing though

hmm, I tried keeping `P` as a matrix and changing the M2 line to `M2←{(⍸↓⍨2-2×+/)(⊢=⌊/)+/|P-[2]⍵}¨⍳⍴M` but this change appears to be slower
@dzaima I suppose it was the `∘.` part of my initial solution that made it slower, I was handling a matrix 50 times as large
@Cowsquack actually to even `⌈⌿⊢∘≢⌸BAD~⍨∊M2`

6:32 PM
I've got this for `M2` now, now to get rid of the tons of `¨`es

`+/¨¨|(⊂P)-⊂¨⍳⊃⌈/P` how different is this than `(,⍺)∘.(+/∘|-)⍵` (`⍺` is `⍳⊃/P` and `⍵` is `P`)?
because in both you are dealing with 360×360×50 values at once, whereas in your previous solution it was only 360×360

@Cowsquack there
not different at all, except the different shape structure
though mine's still faster

that's a good problem. is it true that the infinite areas are the ones whose letters are on the bounding rectangle?

@dzaima that was my point :P
@dzaima how so?

@Cowsquack `∘.` is a very `¨`y thing

6:44 PM
yes so why should they be different

@dzaima I'll admit I read "`∘.` is a very itchy thing"

@Cowsquack `∘.` ¨es `(⍴⍺)×⍴⍵` times while mine's either just `⍴⍺` or `⍴⍵`
@ngn i don't see how they wouldn't be, though just for safety i added a 300 char border for my 1st solution :p
well mine does do the horrible `≢P × w × h` for the `+/`, but that's only one operation whereas `∘.` has to `¨` everything

@dzaima hm fair point

@dzaima in euclidean-distance voronoi diagrams such an area could extend far out, but indeed here it seems ok to look just at the bounding rectangle
i looked at a few configurations with just 2 points - the dividing line goes at 45 degrees within the rectangle determined by the points, and outside it's parallel to the axes

til what voronoi diagrams are

7:01 PM
@Cowsquack til they make sense with manhattan distance

7:13 PM
i solved it in k

how fast is it?

```real	0m0.142s
user	0m0.088s
sys	0m0.056s```

nice, how does it work?

are you doing fancy things or just the same brute force

brute force, give me a moment to write a few comments...

7:16 PM
I've got `(⍳∘1¨ × 1= +/∘↑)(↓=⌊/)+/|↑↑(⊂P)-⊂¨⍳⊃⌈/P` for M2 but its still ugly and didn't improve speed at all

```a:+.'0:"6.txt"
a:a-&/'a           /translate to top-left limit
n:1+|/'a           /size of bounding rect
i:!n               /lattice points
d:a-\:'i           /deltas by x and y
d:+/d|-d           /manhattan distances
c:d=\:&/d          /bool matrix of closest points
c:c*\:1=+/c        /only the unambiguous
b:|/(i=n-1)|i=0    /bool mask of boundary points
|/(~|/'b*/:c)*+/'c
\```

@ngn `translate to top-left limit` does that mean you're moving the top-left point? that's cheating :p

@dzaima i'm subtracting (min(xs);min(ys)) from all points
^ ...in accordance with our observation about the bounding rectangle

579ms with moving the top-left point. :/

@dzaima dzaima/apl or dyalog?

7:24 PM
@ngn dyalog obviously. my apl would be at least many seconds, besides probably not working
ಠ____ಠ `"LengthError: ranks don't equal (shapes: vs 8)"`

hm, we should be measuring on the same machine :)

and the same input set :p

ah, that too :)

i dont feel like bothering to figure out what the hell is happening here
oh right my apl doesn't need `⊃` after `f/vec`. back to the previous error :|

@dzaima i think it would be more efficient (in either apl) if you stored the coords in a mixed matrix

7:33 PM
@ngn yeah probably (though not in my apl, it really shouldn't care besides cache (and the small list of points should be small enough to fit somewhere))
oh cool (besides that `⊂17` :|)
yeah my apl just eats ram before getting to anything

@dzaima try removing the `[]` from `⌈/[]`

oh hey `real 0m28.335s user 0m51.745s sys 0m1.743s`. i expected way worse :p
@Cowsquack yeah, i noticed that fixes that. `/[]` is my way of writing `⌿` though there `/` works just fine

8:06 PM
i translated my solution to dyalog and it runs in about the same time :(

same time as mine or yours

as my ngn/k solution

@ngn How does your K compare to The?

@Adám to the original k?

@ngn Yeah, well, one of the… 7?

8:10 PM
@Adám i don't know how it compares to k5, k6, etc, i don't have them. compared to ok, of course i am way faster

@ngn And k3/4?

it's hard to tell with kona as it follows very old syntax and i can't compare fairly
@Adám that's a good question

@ngn I meant the K that comes with kdb+

@Adám any particular test you want me to perform?

@ngn Really, you could compare to K7 too, but then you'd have to use macOS… ⍨
@ngn I was thinking of that algorithm you have been using above

8:12 PM
@Adám over my dead body

@ngn IKR. I don't get it; though I've never met AW in person, he doesn't strike me as the typical macOS guy.
Maybe because macOS is the only consumer OS that lets you easily input a variety of delicious Unicode glyphs without having to install anything or change any settings?
I mean, he's working on kOS… That's like the polar opposite of macOS!

@Adám this requires some porting... i'll give it a try
```\$ time ~/q/l32/q 6.k <<<''
real	0m0.308s
user	0m0.260s
sys	0m0.044s```
^ @Adám about two times slower, but ofc that's 32 bit and perhaps i'm not doing it in the most optimal way

@ngn Right.

it doesn't have `!x` with a list, so i used `n\:!*/n`

8:39 PM
i also had to change the first line to `a:+.:'0:`:6.txt`
by the way, i made up my mind about `.:'` vs `.'` - i'm not gonna require the `:`
but i'm still hesitating about whether i should support ``:filesymbols` for compatibility

1 hour later…
9:46 PM
@Graham We do have some tools, and may even be able to offer some assistance in migrating. You're not alone.

@Adám Hi this is my first venture into this chat room. I am aware of the tools available but that is only part of the issue. When I looked into Dyalog at the time it appeared to have diverged from what I was used to in that it had become wordy like other languages. The thing that attracted me to APL was its pure symbolic notation. Code Golf is much closer to my view of APL than what I saw in Dyalog

@Graham Wordy? You mean like `:If`, `:For` etc.?

@Adám No I do not have an objection to control structures as they exist in APL+WIN. To give you a better example I would need to fire up my Dyalog interpreter and give you a concrete example.

@Graham OK… Dyalog APL is really a superset of ISO's standard APL (just like APL+ is), so I doubt you'll find yourself forced into any wordiness. Unless you're talking about OO of course.
@Graham If anything, Dyalog APL allows you to be even more terse and un-wordy by allowing tacit programming, i.e. without even mentioning the names of your arguments.

@Adám OK. Again I accept that OO does require a lot of words as I make a lot of use of things like xl via dot notation. It might be better if tomorrow I fire up Dyalog and try and find an example of what put me off. With regard to your last comment I am forced to agree as Dyalog almost always beats APL+WIN in Golf

10:17 PM
@Adám This does not take us too far forward but here is an extract of a conversation I had way back in 2009 with someone involved with Dyalog. > me, >> them
@Adám must remember not to hit return for a new line! > I find the .net stuff, in particular, to be a backward step in terms of coding aesthetics. Instead of the elegance of the APL glyphs we now have functions which look more like badly punctuated English essays. I guess it will grow on me eventually particularly if/when I find something I can do with it that I cannot do in plain vanilla APL.

>>I agree fully. I make use of .NET only in rare cases, although it is
usefull. I am always struggling with the Microsoft Help Files, so

@Graham (Pressing Enter for newline is OK, SE chat will merge your messages visually.) Yes, as this person said, you don't have to use .NET, and I barely ever do, except for demonstration purposes. It isn't cross-platform either. If you keep a flat workspace, you won't see the dot notation at all, and even if you do use namespaces, you don't have to use dot notation. E.g. you can extract values from a namespace with `⍎` as well, so `myns.mn2.val` is the same as `'val'⍎⍨'mn2'⍎⍨'myns'`.

@Graham I don't think of the .net in Dyalog as a thing to replace glyphs of it but rather as an optional add-on for the cases when the alternative would be to not use APL at all.

10:33 PM
This is perfectly valid (albeit unusual) .NET'y Dyalog APL: `('ToString'⍎⍨'UtcNow'⍎⍨'DateTime')⊂'hh:mm'`.

@Adám I have just followed your link to the Dyalog site to download the latest free version. Unfortunately I cannot agree to the TOC.
@Adam Whilst I have no intention to using it commercially I, like I assume you do, have a series networked machines on which I would wish to develop APL.
@Adám I have desktop machines in a couple of rooms plus laptops and tablets one of which I am using currently whilst watching TV. I am happy to give Dyalog another try if I can have a copy which can load and use on all my machines

11:32 PM
@Graham Just email sales@ and tell Karen how you intend to use it. I'm sure it'll be OK.