« first day (1613 days earlier)      last day (1044 days later) » 

2:06 AM
Is there a way to map across ⍺, rather than ⍵?
For instance, 1 3 2↑¨⍳5 would give:
1 1 2 3 1 2
The closest I can come in this particular case is 1 3 2↑¨(⍳5)(⍳5)(⍳5), but perhaps one can do better?
 
1 3 2↑¨⊂⍳5
¨ maps across both arguments always, so if you want one to be constant, just it
 
The best I have rn is 1 2 3{⍺↑¨(≢⍺)⍴⊂⍵}⍳3
Oh wait, sorry dzaima, let me read
@dzaima Woah, no way, thanks!
This isn't even the slightest bit familiar
Is it time to reread the Legrand book?
I'm not sure I totally get it, though. Mind elaborating on how the constant bit works
 
so let's break down the individual components
 
Thanks, please
 
so the right side ⍳5 you obviously get what that means
that returns an array, which is a vector (1-dimensional) of dimensions 5
⎕←⍳5
 
2:15 AM
@hyper-neutrino 1 2 3 4 5
 
Wait! We do have a bot working?!
 
if you then enclose it with , it packs the array into a single-cell array
so now you have a single-cell array containing a vector
⎕←⊂⍳5
 
@hyper-neutrino
┌─────────┐
│1 2 3 4 5│
└─────────┘
 
Right
 
@AviFS yep, as of a few days ago :)
 
2:15 AM
The constant bit is new to me, though
@hyper-neutrino Awesome!!
 
when dzaima says constant they just mean if you want one side to not loop
so you're looping on both sides between 1 3 2 and 1 2 3 4 5 initially
 
Are you really?
 
but now you're looping between both sides of 1 3 2 and ⊂ 1 2 3 4 5
yes, by default it loops through both sides
 
That makes sense in principle
I hadn't realized it mapped over both though
 
⎕←1 2 3{⊂⍺,⍵}¨1 2 3 4 5
 
2:16 AM
Trying to make sense of that
 
@hyper-neutrino
LENGTH ERROR
      ⎕←1 2 3{⊂⍺,⍵}¨1 2 3 4 5
                ∧
 
It always looked to me like it was mapping only over ⍵
 
⎕←5 4 3 2 1{⊂⍺,⍵}¨1 2 3 4 5
 
@hyper-neutrino
┌─────┬─────┬─────┬─────┬─────┐
│┌───┐│┌───┐│┌───┐│┌───┐│┌───┐│
││5 1│││4 2│││3 3│││2 4│││1 5││
│└───┘│└───┘│└───┘│└───┘│└───┘│
└─────┴─────┴─────┴─────┴─────┘
 
@AviFS right - most things you've worked with probably had a single-cell or scalar
 
2:17 AM
@hyper-neutrino hmmm, that's true. super interesting
@hyper-neutrino ah, that makes a lot of sense
thanks for explaining that part
 
glad it makes sense :D
 
Gosh, I'd never realized
This makes it easy to see for me, too
⎕←1 2 3↑¨3 2 1
 
@AviFS
┌─┬───┬─────┐
│3│2 0│1 0 0│
└─┴───┴─────┘
 
take what i say with a grain of salt tho - i'm pretty new to APL so stuff i say may be totally wrong and just happen to work out in specific situations
 
no, it's super helpful and makes a lot of sense
Question then:
 
2:20 AM
@hyper-neutrino you're on point :)
 
woo \o/
 
Can you only map then if ⍵=1, ⍺=1 or ⍺=⍵
 
@hyper-neutrino (except that that's a bit excessive and could just be ⎕←5 4 3 2 1{⍺ ⍵}¨1 2 3 4 5)
 
@dzaima
┌───┬───┬───┬───┬───┐
│5 1│4 2│3 3│2 4│1 5│
└───┴───┴───┴───┴───┘
 
oh
yeah that
 
2:21 AM
haha, i did notice that
@AviFS My sense is there are some that work so long as one is a multiple of another
 
(how does the wiki page of scalar extension not mention ಠ_ಠ)
 
And some might work even if not multiple. Just duplicate and cut off
 
i believe so yeah - if either is a scalar or singleton or otherwise they need the same length
 
Or is this always the case: only map then if ⍵=1, ⍺=1 or ⍺=⍵?
@hyper-neutrino well it's good enough for now, thanks a bunch!
 
@AviFS you can map when either side has rank 0, or one has 1=×/⍴it, or both have equal shape
(note that the case of 1=×/⍴arg is a historical wart and shouldn't be relied on)
 
2:24 AM
@dzaima fancy fancy
Can you give an example of thing with such shape please?
⎕←×/⍴(1)(1)(1)
 
@AviFS 3
 
is the only thing I can think of, which doesn't work
 
@AviFS more fancy: you can map when ⍺(∨⍥(×/⍴)∨≡⍥⍴)⍵
 
arghhhhhh
 
@AviFS ⎕←⍴ 1 1 1⍴1
 
2:26 AM
@dzaima 1 1 1
 
more fancy: you can map when ⍺(∨⍥(×/⍴)∨≡⍥⍴)⍵⍝∨<?⍴∨≠*⍴○⍺⍳⍤⍥⍣⎕⍟⍋⍲⍫!⍟⊖⍉⍋⍱⍟⍲!∩⌈∩⍀|⍺⍝⎕∘*⍵○∊⍴↓∨?¯<≠>≤⍴∆⍳~↓⍺_⊤⎕’∘⌈⊤⊤∩∘⊤⍺’⍵↑↓○?∨○
@dzaima ah, thanks
 
@AviFS (but better just ignore that part and just use )
 
haha, of course
also, golfy question:
CMC: Which I'll cheat and steal for my submission
Remove the first element after every nonzero element. (The element to be removed is guaranteed to be a zero.)
So: 0 0 0 1 0 2 0 2 0 3 0 3 0 2 0 2 0 1 0 0 0 0
Becomes:
0 0 0 1 2 2 3 3 2 2 1 0 0 0
My current way is a bit sketchy:
⎕←{⍵/⍨1,≤∘0¨2-/⍵} 0 0 0 1 0 2 0 2 0 3 0 3 0 2 0 2 0 1 0 0 0 0
 
@AviFS 0 0 0 1 2 2 3 3 2 2 1 0 0 0
 
3:03 AM
@AviFS To clarify, this was the golfing question!
 
is this just implement a stack / backspace an array
in which case what if you input 1 2 3 4 0 0
 
@AviFS in that example it'd work to just remove every second element
 
@dzaima No, only remove zeros after nonzeros
Not at all, where are you guys getting the stack bit?
 
oh wait, no it isn't - i misread
 
3:16 AM
haha, no worries
 
oh, i also misread a bit
⎕←{⍵⌿⍨¯1↓1,0=⍵}0 0 0 1 0 2 0 2 0 3 0 3 0 2 0 2 0 1 0 0 0 0
 
@dzaima 0 0 0 1 2 2 3 3 2 2 1 0 0 0
 
is input non-negative?
 
@hyper-neutrino Yup!
 
3:21 AM
@dzaima if i understand correctly, {⍵⌿⍨¯1⌽0=⍵} also works
 
I got it down to this, just struggling to trainify the left end:
(w/⍨1,2≤/⊢)w
Where w is the array
 
(⊢(/⍨)1,2≤/⊢)w should work
 
Defn might be shorter:
⎕←{⍵/⍨1,2≤/⍵}0 0 0 1 0 2 0 2 0 3 0 3 0 2 0 2 0 1 0 0 0 0
 
@AviFS 0 0 0 1 2 2 3 3 2 2 1 0 0 0
 
yeah, trains lose a lot when / is involved
 
3:26 AM
Darn, I forgot about the / bit with trains
You're right
But actually, they'd be the same even without
⎕← ≢¨'{w/⍨1,2≤/⍵}' '(⊢(/⍨)1,2≤/⊢)'
 
@AviFS 11 13
 
Without parens req for /, they'd both be 11
So still no better
@dzaima that's also 11
 
 
2 hours later…
nice! two things though - 1. i discourage "beats other answers" notes because they can become false later and it's not really necessary and 2. don't comment under other posts saying you outgolfed them
i might not mind, but people might find that really annoying lol
 
@hyper-neutrino Uh oh true, I'll definitely remove point 1
 
i'll give it a shot but i doubt i can outgolf lol
 
But for 2, I'm only doing it because I've seen others do it
It's the first time I do and I'm happy to delete
But I'm almost positive it was Adám, which feels trustworthy
 
fair enough ¯\_(ツ)_/¯
 
5:19 AM
And on second thought, tbh I don't intend to leave the "Shorter than the other APL answers so far!" for long
Nor the "Will add explanation soon!" for that matter :P
The idea was really anything but to show off
I just figured there's 3 APL answers now...
Out of just 16 answers
I'm figuring people don't care to see another one, so I added that to get some attention, haha
 
that's fair enough :p again it's not really a big deal anyway
 
I figured people might not upvote the third submission in a language they've seen several
And it's not really enough of a win for people to notice
They're all in the 60s, haha
 
eh, it's more likely to not get upvotes due to being too old of a challenge that people just skip over :P
 
True...
Sh*t, I didn't realize it was 7 freaking years old
 
even if someone posts an answer that loses to an earlier post i'll still upvote it if i found it interesting to look at or good by some metric
 
5:22 AM
Of course, so would I
I don't know how interesting it is, tbh
It's just shorter
Thanks for the upvote, I'm guessing that was you, haha
 
it was, i forgot to the first time :P
 
how could you!
@Adám Searched Google for your bounty post...
Let's go!
 
question - what's a good way to partition an array at specific indices?
e.g. I want 1 4 6 f 1 2 3 4 5 6 7 8 to give (1 2 3) (4 5) (6 7 8)
or 1 0 0 1 0 1 0 0 f 1 2 3 4 5 6 7 8
 
@hyper-neutrino dyadic ?
 
oh ಠ_ಠ i do not know how i missed that
 
5:34 AM
@AviFS gonna be difficult to outgolf this without a different approach
 
You think?
I feel like some minimal things could be improved
There's a lot of parentheses and ¨
I'd be surprised if there weren't a few bytes that could be shaved off
See!! You did find something, razetime
 
how do i turn an array of vectors into a matrix? ideally it should pad if jagged
disclose didn't work, as i (somewhat) anticipated
or whatever is called
 
 
oh lol
 
⎕←↑(1 2 3)(4 5 6)(7 8 9)
 
5:44 AM
ty
 
@AviFS
1 2 3
4 5 6
7 8 9
 
It's called mix!
Don't ask my why
 
ah, good to know, thanks! yeah idk what to search for, lol
 
And it'll conveniently pad if not rectangular
⎕←↑(6 4) 5 3
 
@AviFS
6 4
5 0
3 0
 
5:45 AM
@hyper-neutrino for sure! thank you for all your help
and for giving me a question I could answer, haha
 
6:05 AM
⎕←⊂ 2 2 ⍴ ⍳ 4
 
@hyper-neutrino
┌───┐
│1 2│
│3 4│
└───┘
 
⎕←⊂¨2 2 ⍴ ⍳ 4
 
@hyper-neutrino
1 2
3 4
 
is there any way to like, enclose each col (or row)?
 
probably using rank
 
6:14 AM
i think this is a bit of an xy problem lol. i'll try to figure out a non weird way of doing this and ask if i have a more specific question
 
      ⊂⍤1⊢2 2 ⍴ ⍳ 4
┌───┬───┐
│1 2│3 4│
└───┴───┘
 
ah
i see. ty
 
rank is really really good for multidimensional arrays
 
 
1 hour later…
7:20 AM
@hyper-neutrino Unless I'm missing something, this is just the opposite of mix from before!
Flip and you get
⎕←↓2 2 ⍴ ⍳ 4
 
@AviFS
┌───┬───┐
│1 2│3 4│
└───┴───┘
 
And if you want to do by column instead of by row, you can do:
⎕←↓[1]2 2 ⍴ ⍳ 4
 
@AviFS
┌───┬───┐
│1 3│2 4│
└───┴───┘
 
It defaults to ↓[2]2 2⍴⍳4 in this case
@Razetime This work too!
 
7:37 AM
yeah I should have used that
 
 
5 hours later…
RGS
12:32 PM
@rak1507 @Razetime are you doing the bioinformatics contest final now?
(now = in 28min)
 
yea will you?
 
RGS
Yeah
Whatever I don't do in the next ~6/8h, I won't do at all
Tomorrow I won't have time for it
 
@RGS probably will
I'm awake rn
 
RGS
Right, cuz it's later for you.
 
I'll probably lose about 8 hours sleeping
If I can think through it well I'll probably stay up a bit
 
RGS
12:41 PM
But wait, is there any scoring based on time? I thought it's just points gained
 
i am sure there's time based scoring on this one
it's also time limited
 
RGS
Sure, Dyalog's competition is also time limited but there's no scoring based on time
 
@RGS I've made quite a few changes to the book, making consistency changes based on your suggestions. Let me know if you would prefer a fresh cut (I'm happy either way).
 
RGS
@xpqz fresh cut, please
Sorry I haven't posted any revisions lately :'(
 
Coming right up.
@RGS It's a lot of words, and you have a day job -- I'm happy with anything.
 
12:48 PM
@RGS i'd say there's a big difference between a few months and 24 hours :)
 
RGS
It still is limited 🙃
Both 1 and 45464623455634572546246 are finite integers, although I agree the latter is bigger.
 
@RGS Wait, are you a mathematician?? :)
 
so in a 24 hour period it does make more sense to score based on how quick answers come in
 
RGS
@Razetime oh yeah, absolutely! it makes definitely more sense, I just didn't think they did that. For some reason I thought the next tasks are going to have such granular scoring that timing didn't matter.
 
or they're just going to be absolute pain
maybe if they're hard enough they won't have to worry about time based scoring
 
RGS
1:02 PM
yeah
Well, good luck
 
1:14 PM
lol wtf is this
problems so hard
 
RGS
yeah
and no perfect scoring
 
I don't even understand problem 1
where do 101101 and 010001 come from
 
RGS
The point is that you don't have enough information to know how to fill in the ?s, so you have to infer from whatever you can what those ? should be
And my interpretation for the sample I/O, is that they say
well, for the first person, if they had strings 101101 and 010001 then their genotype would be 111102, and that matches with ?11?0?, so that's our guess
My understanding is that it is our job to figure out what are the most likely binary strings or smth like that
oh darn, for the life of me, I cannot understand P2 :P
 
1:35 PM
i can kinda get p2 but it;s not obvious how the solving will go
 
RGS
Well, now I understand the question as well, but I also have no idea how to attempt to solve it :P
 
based on point value superspreaders is probably the easiest
 
RGS
One thing that bothers me is that there is a mathematically correct answer for P3, but they score based on simulations they did and not on the actual correct value?
Or do you think they did the simulations with the actual correct answer?
 
1:51 PM
it seems that they have done it with the correct answer
cause people are scoring 100% on it
 
2:34 PM
yay i figured out Q1
 
2:48 PM
nice
 
Q2 and 5 have the most weightage
so figuring those out would be worth a lot
 
RGS
well, I'm starting off with Q3 :P
 
 
2 hours later…
5:05 PM
does anybody know a decent way to represent a graph and add nodes to it
 
I wonder what you're doing :P
 
I am doing a huge pain
 
5:33 PM
Is there a way to have quotes display for strings?
 
you could use ⎕SE.Dyalog.Utils.repObj
ah, nvm, doesn't quite work
¯1↓1↓⎕JSON ,⊂s
 
no i mean by default
 
doubt it
 
@Razetime use dzaima/APL :)
 
I wasted about an hour agonizing over certain thing due to strings looking like arrays
@dzaima does dzaima/APL have an STL graph like thing tho
 
5:45 PM
@Razetime nope
 

« first day (1613 days earlier)      last day (1044 days later) »