« first day (2053 days earlier)      last day (602 days later) » 

1:10 AM
@rak1507 Interesting. Can you say a bit more about why?
 
 
5 hours later…
5:59 AM
seems like the investcloud offer was closed Apr 13 2022. @Adám Should we remove it?
 
 
2 hours later…
8:15 AM
@Razetime Yes, please.
 
 
1 hour later…
9:16 AM
is apl wiki undergoing maintenance
it is spazzing out
some php errors
 
@Adám
 
@Razetime Yes my apologies
We got a slew of spam registrations so I'm trying to upgrade mediawiki and add extra spam prevention
thought it would be quick so I didn't put anything on the front page
 
9:49 AM
Btw images are replaced with errors for me, now
 
oh, I see.
Well luckily i saved my in progress edit in a text file
 
@awagga I see
ok images might be back now
 
10:07 AM
yep
 
10:49 AM
@Razetime Which article were you writing raze?
 
APLWiki has been upgraded to MediaWiki 1.38 - I'm just going through and updating extensions
you should be able to edit again now, but user creation is still disabled until I get the captcha up
 
11:04 AM
@Marshall ever used the CodeEditor extension on APLWiki?
 
11:24 AM
@RikedyP No. I just open a text editor for anything complicated.
 
@Marshall Okay I'm getting rid of it, I don't think the tickbox to enable it was even ever made visible anyway
all extensions related to page content should be enabled now
if something looks wrong just complain
 
@awagga was editing the jobs article as per above
 
ah okay
 
12:06 PM
How do you find non-overlappingly?
For example, 1 1⍷0 0 1 1 1 1 1 0 0 gives 0 0 1 1 1 1 0 0 0, but I want 0 0 1 0 1 0 0 0 0, just like how searching for 11 in 001111100 with regex would work.
 
12:19 PM
@rabbitgrowth Since your search for something of length 2 you could insist that the bit to your left is not set.
But you’d have to consider the ones you toss out as zero so you need to do it incrementally.
 
12:35 PM
Could just be me... If I run RIDE_INIT http:*:8888 dyalog in the terminal, cause an infinite loop in the browser client and then kill the terminal, dyalog persists in the background... At least on Linux
 
@RikedyP looks wrong.
 
@Adám that is weird
 
12:53 PM
@rabbitgrowth it looks like magic but this does it: ⎕←>/⍤⌽¨,\1 1⍷0 0 1 1 1 1 1 0 0.
 
@doug 0 0 1 0 1 0 0 0 0
 
@Adám fixed now
 
… And it only works for searching for length 2 strings. The idea is basically what I said above. Scans in APL are right folds which I have a harder time picturing. This translates a left fold scan of < into a right fold scan. `<` turns every other 1 in a string of ones to zero as a left scan.
 
I think ,{1 1⍷⍵}⌺(⍪2 2) works too
 
I thought there was a way to do nonoverlapping stencil but a quick scan of the docs didn’t turn up anything. Nor did APLcart. Obviously stencil has the potential to work for longer strings and so probably preferable.
 
1:03 PM
Will fail on singletons though
⌺(⍪2 2) should probably be on the aplcart
 
Ahh.. It’s pretty clear when you don’t do a quick scan: “ In general, the right operand g is a 2- row matrix of positive non-zero integers with up to ⍴⍴Y columns. The first row contains the rectangle sizes, the second row the movements i.e. how much to move the rectangle in each step. If g is a scalar or vector it specifies the rectangle size and the movement defaults to 1.”
Actually, this seems to depend on the parity of the index of the first 1. I.e. put a zero in front and your steps might not pick up the right ones.
The magic of the scan version is it doesn’t matter where the cluster of ones is.
 
1:25 PM
@Connor because there's nothing 'magic' about it, it is 'just' a programming language (albeit a cool one that is convenient for certain things)
 
@doug Yep. Scans are fairly awesome
\ and . are some of my favourite primitives. Especially in conjunction.
 
@Adám I think I have a general left scan algo for finding nonoverlapping groups of a given length. Here’s the k: ngn.codeberg.page/k/…
 
@doug Thank you!
 
Left scan of max(acc,iter*(length-1)>(iter-acc))
Here multiplying by the predicate kills ones that are too close. Once you’re not too close the max picks up the next one. The take the unique at the end.
It works on indices so you’ll have to reconstruct the mask if that’s what you want.
 
@RikedyP Sure, but I can't edit anything. I get a huge backtrace.
 
1:48 PM
@rak1507 Not sure if it’s deep but @dzaima pointed out that <\ as a left scan is {x+x*y}\ which is perhaps surprisingly useful. I used it in the post just above.
 
I wouldn't really say that's 'mathematical', although it is cool
(it also doesn't work if you start with 0)
 
I meant to add mod 2 as well
 
and seems to do something weird otherwise... maybe I'm calling it wrong
 
These are left scans so it’s easier to use K.
 
1:53 PM
 
ah, got it
 
For people not clicking I should have said 2!{y+x*y}\ where 2! takes mod 2 in K.
But the idea is similar to the one above. The predicate kills the values you want to die and leaves the rest.
This is why it looks only at clusters of ones. Once you hit a zero the accumulator resets.
 
2:51 PM
@Adám uh oh
looking into it after this meeting
@Adám sorted now
 
Yes, works now.
 
display is bugged on mobile
 
Welcome to APL Quest 2016-2! Today's quest is Statistics - Median:
> Write a function that takes a numeric vector as its right argument and returns the median of the array.
 
I fear that mine is not very efficient and that I missed something
{⍵≡⍬:0 ⋄ j≠⌈j←2÷⍨≢i←w[⍋w←,⍵]:i[⌈j] ⋄ 2÷⍨(i[j]+i[j+1])}
 
(Oh, before I forget, note that APL Quests will be 2 hours earlier, at 13:00 UTC, beginning 14 October 2022.)
 
3:01 PM
((+⌿÷≢)⊢⌷⍨∘⊂(⌈1-⍨2÷⍨≢)(-⍤⊣↓↓)⍋)
 
In 19.0: 2÷⍨1⊥(⌈2÷⍨0 1+≢)⊇⍋⍛⊇
 
I have (2÷⍨1⊥⊢⌷⍨∘⊂⍋⌷⍨∘⊂∘⌈2÷⍨0 1+≢) on APLcart.
@awagga Hopefully. Also: 2÷⍨1⊥⍋⍛⊇⊇⍨∘⌈2÷⍨0 1+≢
 
Yep, same length though
 
Yes, missed that at first. But less parens, so…
 
Look ma...
@Richard fwiw i think this is cute
 
3:04 PM
Sometimes I miss integer division. Should be faster than rounding the float, right?
@Richard That's a really clear solution. Only complaint is 2÷⍨() where you could either remove the paren or swap args and remove
Oh, and it is the only solution so far that handles scalars per the problem spec.
 
@Adám ah yes, forgot to remove them, that's why I used ⍨
 
@rabbitgrowth I like your double-drop. I have this idea of extending so you can write (⊂2 ¯2)↓ instead of 2↓¯2↓
 
Both nice solutions.
And of course:
mindex ← (⌊,⌈)∘(0.5∘×)∘(-∘1)∘≢    ⍝ or (⌊,⌈)∘halve∘decrement∘≢
median ← ⊂∘mindex mean⍤⌷ ⍋⍨
 
I wonder if picking out elements of the sorted array is faster than using grade directly.
@awagga RH style?
 
Yes
 
3:09 PM
But this relies on breaking backwards compatibility.
 
I was about to say. Dyadic grade!?
That would be one interesting median solution lol
⊂∘mindex mean⍤⌷ ⍋⍨ -> mindex mean⍤⊇ ⍋⍛⊇
 
Yes.
 
(sorry, not sure why I put extra parens in my solution)
 
@rabbitgrowth what is the idea behind ↓↓ ?
 
For such a complex thing, I'm a bit surprised that we can't think of other approaches.
 
3:16 PM
@Adám I kinda like 2↓¯2↓ though. Reminds me of 0,0,⍨ which is nice
@Richard It's a fork:
 
Sure. It is mostly to allow to handle small (relative to the window size) arguments.
 
 ┌─┼─┐
 ⍤ ↓ ↓
┌┴┐
- ⊣
 
Here's a recursive one: {2≥≢⍵:2÷⍨+/2⍴⍵ ⋄ ∇⍵[(⍳≢⍵)~(⊣/,⊢/)⍋⍵]}
Works on scalars and too.
Any leading axis solutions?
Anyone else bothered by writing ⊃,⊢/ for first and last?
I'm really thinking monadic should be {⊃⌽,⍵} so you can write ⊃,⊇
 
that would be nice indeed.
 
I'm not sure a leading axis definition makes sense. While we can use TAO to pick the middle 1 or two major cells, and we can take the average of two major cells, the two definitions are fundamentally incompatible.
Are we there yet?
See you next week for 2016-3: Statistics - Mode, and don't forget that we'll begin to start two hours earlier (at 15:00 UTC) in 5 weeks.
 
3:31 PM
@Adám Wait, why not just {2≥≢⍵:2÷⍨+/2⍴⍵ ⋄ ∇⍵[1↓¯1↓⍋⍵]}?
 
@rabbitgrowth Oh, that's much better.
I think I'll use that in the video.
 
Cool!
 
Probably with a variant of Richard's solution, for a direct computation.
 
3:54 PM
Sorry, was a bit distracted with your sugestion for monadic ⊇. What use is monadic ⊆?
⋄ (⊆ 'this' 'that' )≡ 'this' 'that'
 
@Richard 1
 
4:12 PM
@Richard encloses if the argument is simple.
 
 
2 hours later…
att
5:57 PM
@Adám yeah it does feel weird
 

« first day (2053 days earlier)      last day (602 days later) »