« first day (5116 days earlier)      last day (22 days later) » 

00:02
34
Q: All together now

xnorGiven a list of digits 1 through 9, output whether each digit is grouped together as a single contiguous block. In other words, no two of the same digit are separated by different digits. It's OK if a digit doesn't appear at all. Fewest bytes wins. Input: A non-empty list of digits 1 through 9. ...

00:37
@Jonah a ∧ b, reflected horizontally I think?
01:10
@RubenVerg yes, much more succinct than my linked explanation
 
9 hours later…
10:30
it really has been four years
 
3 hours later…
13:26
CMR: Euronight - Eurogroove: music.youtube.com/watch?v=mhNQiOwpfwo
 
2 hours later…
15:39
I asked a SO question which is mystifying me a little stackoverflow.com/questions/79403159/…
branch prediction?
@Themoonisacheese oooh, go on?
for each instruction your cpu executes, it can (will) take multiplee cpu cycles, but it can warm up the next instructions, for example by starting to fetch things from RAM (which is slow as balls) in advance of actually executing the next instruction.
does the block code do this better somehow?
problem: if the current instruction is a branch, it can't know what the next instruction is because it might or might not take the branch and there's no way to know until you've executed the branch
so the CPU decides somewhat arbitrarly whether or not it should warm up either side of the branch, based on some algorithm. the algos mustt be implemented in silicon, so most of the time, it's a heuristic based on how many times you've taken (or not) this particular branch, which is very useful in long running loops, because loops have at least 1 branch instruction to test if they should stop looping
15:46
The difference seems too big to be explained by branch prediction
problem: if your cpu fails its prediction, it actually has to start over from right after the branch, so you don't get the speed benefits and that can eat into your performance quite a bit
there is a risk it just isn't computing the right thing of course!
this is also the case for prefetching from RAM, it'll try to anticipate that you might need a page from ram in the future based on your previous access patterns, so for example it's much faster traversing a (c) 2D array by lines rather than columns
Does setting method='direct' change anything?
I'm looking at the code here: github.com/scipy/scipy/blob/…
@mousetail'he-him' ValueError: Acceptable mode flags are 'valid', 'same', or 'full', not mode=direct
oh its method
@mousetail'he-him' you solved it. It is using the FFT but it gives the right answer because the blocks are small enough it seems
this is far superior chat room!
Definitely at the top of B tier
27407
Q: Why is processing a sorted array faster than processing an unsorted array?

GManNickGIn this C++ code, sorting the data (before the timed region) makes the primary loop ~6x faster: #include <algorithm> #include <ctime> #include <iostream> int main() { // Generate data const unsigned arraySize = 32768; int data[arraySize]; for (unsigned c = 0; c < arraySize; ++c)...

in ^ case its 6x
That's a very specific circumstance, I assume scypi is itself already highly optimized and looks a lot like SIMD's code
this comes from a scipy bug report. When scipy.signal.convolve uses the FFT it gives completely the wrong answer when e.g. a = np.array([0]*10000 + [10**(9*i) for i in range(10)], dtype=np.float64)
I meant, my block_code effort does
16:13
sft when?
sft?
slow Fourier transform
:)
I am assuming that was a joke?
Your brain's branch prediction is working correctly
6
:)
I don't know of a way to make the FFT accurate except it seems this block method
16:19
If the block method seems accurate, what's wrong with it?
I don't know how to set the block size to guarantee a correct answer when I have different arrays
I assume it's possible to make an array for which the block size I chose will give the wrong answer but direct would give the right answer
A smaller block size will be slower but give a more accurate answer right?
yes
Will the same block size on a larger total array size reduce accuracy?
umm
the problem is more the range of the floats in the array I think
16:25
Ah, well can you find the max/min of the array in advance and compute a safe block size based on that?
I don't know how to find the safe block size from the max/min in the array
or even if that is enough information
17:08
Instead you can say "I know it's safe up to this size and up to this range" and throw and error if it's above. You can then manually test that specific case and increase the safe bounds if it looks fine
I guess I could do this by comparing the output to what direct gives
 
1 hour later…
18:10
@rydwolf MacGPTyver :)
Nah I'm just trying to trick it into saying how to make explosives lol
Just got it to, actually
(What's really interesting is that it mixes up HMX, the chemical whose full name I gave, with Tetryl, a much different explosive, and yet objects to neither)
I think that as long as you say that it is "for science", it's going to accept the request.
But yeah, pretty interesting nonetheless
grrr...llvnlite doesn't support float128 or long doubles. Annoying
has anyone noticed chatgpt has gotten a lot more conversional recently
like asking more questions
 
1 hour later…
19:39
CMC: Given two positive integers M and N, output all increasing arithmetic progressions of exactly N positive integers that end with M.
E.g. M = 10, N = 4 should give
7, 8, 9, 10
4, 6, 8, 10
1, 4, 7, 10
You can use nonnegative integers (i.e. including 0) if you prefer.
You can assume N > 1 if that makes it easier.
@Seggan interesting. They are feeling the heat from the Chinese
Deepseek is still down half the time.I assume the big money people are responsible
19:58
@DLosc ...as simple as this is, I'm finding it quite surprisingly difficult to actually golf elegantly
Yeah, I spent a while trying to figure out a good approach (not even golfed) in Python yesterday, made myself late to D&D, and had to come back to it today.
🫂
So far I only have two 11-byte disasters in Jelly
RṚmⱮ:’}¥ḣ€U
:’}¹×€Ḷ}⁸_U
:’}
For reference, my Python code:
def progressions(high_number, steps):
 step_size = 1
 while (low_number := high_number - step_size * (steps - 1)) >= 1:
  yield list(range(low_number, high_number + 1, step_size))
  step_size += 1
I was trying to use a for loop, but I kept getting off-by-one errors until I said "Forget it, we're doing this the old-fashioned way"
20:09
Yeah, I'm basically doing that except with :’} (M floor-div N-1) as an explicit upper bound on steps
feels clunky as hell though
except I'm also not doing that at all because the reallly clunky part is I keep generating the progression backwards then reversing it, either as offsets starting at 0 or as literal step sizes but in range(M, 0, -1)
Ah, hmm
ahh, Cr0×þ¹+fA$ in 10 without the explicit bound (and taking N on the left)
...and RC×þU+fA$ in 9 :P
I redid the math and the maximum step size should be M-1 floor-div N-1. Meaning in Python I could write for step_size in range(1, (high_number - 1) // (steps - 1) + 1). It really is all off-by-one errors all the way down. =P
😭😭
Oh yeah, M-1 if strictly positive
@UnrelatedString How do I run it? I'm getting no output.
Wait, arguments swapped?
20:22
Reverse the args
yeah
There it is. Nice.
:D
thanks!
Bounty incoming in like 3 or 4 hours btw :)
:)
@UnrelatedString Okay, so how does this work?
20:51
1 minus [1..N], multiplication table with that and M, reverse each row, add M, filter rows to absolute values of rows
very nice :3
Ohh, the outer product auto-casts M to a range.
So, uh, I got an idea, and...
It generates all length-N increasing sequences whose start number and step size are between 1 and M, and then fails unless the end number equals M.
att
att
21:44
22:05
@DLosc Vyxal 3, 8 bytes: ℈ʎδ≈|t¹= Vyxal It Online!
Combinations without replacement of range(M) with length N
Filtered by whether the forward differences are all the same
And then filtered by whether the last item == M
22:24
Let’s go! I can finally chat now!
22:38
@lyxal Interestingly, that's the same as what I came up with in Brachylog, after a LOT of trying stuff that didn't work.
23 bytes: t⟦⊇.t~t?h~l.⟨k{z-ᵐ}b⟩=∧
t⟦⊇.       Output is sublist of range(M)
.t~t?      Output's last element is M
?h~l.      N is length of output
.⟨k{z-ᵐ}b⟩= Pairwise differences are all equal
Over the period of 60 days, I have made and released two Roblox games!
23:07
@TheEmptyStringPhotographer wb!
att
att
@att apparently i can't count this is 19 (: also can do slight arg rearranging for 18: {(&/~x>)-[;!x]\x#}
@Seggan welsh biscuits
@TheEmptyStringPhotographer welcome back!
@WeirdGlyphs we don't say why, we say why not
23:42
@lyxal They are probably in panic mode trying to find out what W!nn!e the Pooh is

« first day (5116 days earlier)      last day (22 days later) »