2026/02/24

Newest at the top

2026-02-24 23:31:19 +0100 <tomsmeding> or is there a little loop or something involved
2026-02-24 23:31:07 +0100 <tomsmeding> lantti: do you determine what numbers to print in constant time?
2026-02-24 23:30:21 +0100 <lantti> of course I don't know if any other students are reading this
2026-02-24 23:29:56 +0100 <lantti> tomsmeding: I already passed so you won't boost my grade with it
2026-02-24 23:28:43 +0100terrorjack(~terrorjac@2a01:4f8:271:2d98::2) terrorjack
2026-02-24 23:28:21 +0100 <tomsmeding> (I'm not sure if it's responsible to post my solution publically for people to scrutinise)
2026-02-24 23:27:25 +0100 <tomsmeding> and I can assure you that I am actually doing work that should take <10us plus `putStrLn . unwords . map show` on a lazy list of Int
2026-02-24 23:26:41 +0100 <tomsmeding> it seems printing is actually rather slow on that judge server! On roughly 260000 I take 0.08s, on roughly 653000 I take 0.21s, and on 1000000 I take 0.30s
2026-02-24 23:26:22 +0100 <haskellbridge> <ijouw> yes, it is (n*(n+1))/2
2026-02-24 23:25:48 +0100 <geekosaur> `sum [1..n]` isn't there a number theory approach for that?
2026-02-24 23:25:35 +0100peterbecich(~Thunderbi@71.84.33.135) (Ping timeout: 245 seconds)
2026-02-24 23:24:58 +0100 <tomsmeding> and I'm not sure where even that 0.30s comes from; it takes less than 1ms on that input on my machine
2026-02-24 23:24:08 +0100merijn(~merijn@host-cl.cgnat-g.v4.dfn.nl) (Ping timeout: 268 seconds)
2026-02-24 23:23:28 +0100 <tomsmeding> it's a fun problem :)
2026-02-24 23:23:02 +0100 <tomsmeding> (I figured out a way to compute what numbers to print in constant time; then I just have to print all those numbers)
2026-02-24 23:21:16 +0100 <tomsmeding> lantti: I'm not sure what you did, but it can probably be done more efficiently; this is haskell with `putStrLn . unwords . map show` https://tomsmeding.com/ss/get/tomsmeding/RnFf4z
2026-02-24 23:19:53 +0100tremon(~tremon@83.80.159.219) (Quit: getting boxed in)
2026-02-24 23:19:31 +0100petrichor(~jez@user/petrichor) petrichor
2026-02-24 23:19:06 +0100merijn(~merijn@host-cl.cgnat-g.v4.dfn.nl) merijn
2026-02-24 23:17:50 +0100gmc(sid58314@id-58314.ilkley.irccloud.com) gmc
2026-02-24 23:17:39 +0100gmc(sid58314@id-58314.ilkley.irccloud.com) (Server closed connection)
2026-02-24 23:17:36 +0100 <newmind> mauke: did you get nerdsniped there?
2026-02-24 23:17:05 +0100 <mauke> hah, no. I was wrong about being wrong. I just did it backwards :-)
2026-02-24 23:15:12 +0100 <mauke> nvm, I'm blind
2026-02-24 23:13:01 +0100 <mauke> 1 + 2 = 3
2026-02-24 23:12:45 +0100 <mauke> ah, I see it
2026-02-24 23:11:53 +0100petrichor(~jez@user/petrichor) (Ping timeout: 248 seconds)
2026-02-24 23:10:01 +0100abiss27(~abiss27@user/abiss) abiss
2026-02-24 23:08:07 +0100merijn(~merijn@host-cl.cgnat-g.v4.dfn.nl) (Ping timeout: 264 seconds)
2026-02-24 23:04:47 +0100 <haskellbridge> <ijouw> Working on it
2026-02-24 23:04:44 +0100 <tomsmeding> (there is, but figuring out what the splitting is, requires a little trick)
2026-02-24 23:04:35 +0100target_i(~target_i@user/target-i/x-6023099) (Quit: leaving)
2026-02-24 23:04:32 +0100peterbecich(~Thunderbi@71.84.33.135) peterbecich
2026-02-24 23:04:25 +0100 <tomsmeding> ijouw: do you have a proof that if sum [1..n] is even, there is such a splitting?
2026-02-24 23:04:21 +0100takuan(~takuan@d8D86B9E9.access.telenet.be) (Ping timeout: 255 seconds)
2026-02-24 23:03:59 +0100 <haskellbridge> <ijouw> Isn't the two sets algorithm discussed above easy to compute? The question is whether the sum [1..n] is even (solvable in constant time) (or am I missing something?). Printing could indeed be slowest part.
2026-02-24 23:03:14 +0100philderbeast(~philderbe@57-134-39-54.resi.cgocable.ca) (Client Quit)
2026-02-24 23:02:15 +0100humasect(~humasect@dyn-192-249-132-90.nexicom.net) (Quit: Leaving...)
2026-02-24 23:01:40 +0100Milan_Vanca(~milan@user/Milan-Vanca:32634) (Quit: WeeChat 4.7.2)
2026-02-24 23:01:02 +0100merijn(~merijn@host-cl.cgnat-g.v4.dfn.nl) merijn
2026-02-24 23:00:27 +0100ChaiTRex(~ChaiTRex@user/chaitrex) ChaiTRex
2026-02-24 22:59:44 +0100Guest81(~Guest81@52.144.37.132) ()
2026-02-24 22:59:39 +0100philderbeast(~philderbe@57-134-39-54.resi.cgocable.ca)
2026-02-24 22:58:31 +0100ChaiTRex(~ChaiTRex@user/chaitrex) (Client Quit)
2026-02-24 22:57:44 +0100 <EvanR> repl is overrated, you want to load a file anyway. Then reload
2026-02-24 22:57:07 +0100 <tomsmeding> that's probably easiest, yes (use ghcup)
2026-02-24 22:56:55 +0100 <Guest81> So i need ghci. Thanks all.
2026-02-24 22:55:48 +0100 <tomsmeding> ghci does quite a bit more than just an interpreter for basic expressions, and "learn you a haskell" assumes ghci
2026-02-24 22:55:46 +0100 <mauke> a = [1,2,3] is not an expression
2026-02-24 22:55:35 +0100 <tomsmeding> it is an interpreter, but not ghci