2025/11/11

Newest at the top

2025-11-11 02:10:59 +0100Googulator91(~Googulato@2a01-036d-0106-0180-8127-ba79-55a7-6f29.pool6.digikabel.hu)
2025-11-11 02:10:50 +0100Googulator91(~Googulato@2a01-036d-0106-0180-8127-ba79-55a7-6f29.pool6.digikabel.hu) (Quit: Client closed)
2025-11-11 02:07:16 +0100Sidney(~Sidney@2600:4040:2678:9600:b1c4:ced3:242d:1252)
2025-11-11 02:05:53 +0100Sidney(~Sidney@2600:4040:2678:9600:b1c4:ced3:242d:1252) (Ping timeout: 250 seconds)
2025-11-11 02:05:50 +0100Googulator91(~Googulato@2a01-036d-0106-0180-8127-ba79-55a7-6f29.pool6.digikabel.hu)
2025-11-11 02:05:43 +0100Googulator65(~Googulato@2a01-036d-0106-0180-8127-ba79-55a7-6f29.pool6.digikabel.hu) (Quit: Client closed)
2025-11-11 02:04:29 +0100xff0x(~xff0x@2405:6580:b080:900:2473:b259:8788:143a) (Ping timeout: 260 seconds)
2025-11-11 02:01:30 +0100jle`(~jle`@2603:8001:3b00:11:c2d0:7f27:fab9:22ae) jle`
2025-11-11 02:00:47 +0100spew(~spew@user/spew) spew
2025-11-11 02:00:39 +0100Googulator65(~Googulato@2a01-036d-0106-0180-8127-ba79-55a7-6f29.pool6.digikabel.hu)
2025-11-11 02:00:31 +0100Googulator65(~Googulato@2a01-036d-0106-0180-8127-ba79-55a7-6f29.pool6.digikabel.hu) (Quit: Client closed)
2025-11-11 02:00:18 +0100jle`(~jle`@2603:8001:3b00:11:5098:4041:9bc7:9b0d) (Ping timeout: 244 seconds)
2025-11-11 01:59:58 +0100 <Sidney> complexity without a for loop and a hash table.
2025-11-11 01:59:57 +0100 <Sidney> I agree, I don't want to use stateful operations. I'm missing something because I don't see an alternate. For example `move zeros` (https://leetcode.com/problems/move-zeroes/description/) requires constant space complexity and I don't how `two sum` (https://leetcode.com/problems/two-sum/description/) could be solved with less than O(N^2) time
2025-11-11 01:52:27 +0100 <mange> In general I would say "the Haskell way" is to avoid state, and to think about functional transformations/reductions instead. Even if it's possible to write programs with state in Haskell, you're usually going against the grain of the language.
2025-11-11 01:49:18 +0100 <jreicher> Sidney: what do you need stateful operations for? (Really this is just a polite way for met to ask, are you really really sure you need stateful operations? You might be wrong, and if you're wrong, it's easier to do things without them.)
2025-11-11 01:48:14 +0100gf3(~gf3@user/gf3) gf3
2025-11-11 01:47:40 +0100Tuplanolla(~Tuplanoll@91-159-187-167.elisa-laajakaista.fi) (Quit: Leaving.)
2025-11-11 01:44:48 +0100gf3(~gf3@user/gf3) (Ping timeout: 256 seconds)
2025-11-11 01:44:43 +0100 <EvanR> another way is to use a State monad, there are other ways
2025-11-11 01:43:04 +0100 <EvanR> for the stateful part, there are several ways to "keep the current state", whatever it is. E.g. pass the latest values to a recursive function which stands for the loop body
2025-11-11 01:41:57 +0100 <EvanR> (or IntMap A)
2025-11-11 01:41:31 +0100 <EvanR> Sidney, if the algorithm specifically calls for something like an array of A and numerical indexes, you can pretty easily translate that to a Map Int A and some Ints
2025-11-11 01:40:47 +0100Googulator65(~Googulato@2a01-036d-0106-0180-8127-ba79-55a7-6f29.pool6.digikabel.hu)
2025-11-11 01:40:42 +0100Googulator9(~Googulato@2a01-036d-0106-0180-8127-ba79-55a7-6f29.pool6.digikabel.hu) (Quit: Client closed)
2025-11-11 01:37:18 +0100ttybitnik(~ttybitnik@user/wolper) (Quit: Fading out...)
2025-11-11 01:35:07 +0100 <mange> While Haskell has ST and the like, if you're trying to think "in the Haskell way" then you probably don't want to be using ST.
2025-11-11 01:31:07 +0100comonad(~comonad@2003:d0:2741:a000:c693:4c09:e8b4:6dfd)
2025-11-11 01:29:25 +0100peterbecich(~Thunderbi@172.222.148.214) (Ping timeout: 240 seconds)
2025-11-11 01:18:18 +0100sprout(~sprout@84-80-106-227.fixed.kpn.net) sprout
2025-11-11 01:15:27 +0100 <L29Ah> Sidney: there's ST if you find you want to have a state for efficiency in your black-boxable algorithm
2025-11-11 01:11:16 +0100Googulator30(~Googulato@2a01-036d-0106-0180-8127-ba79-55a7-6f29.pool6.digikabel.hu) (Quit: Client closed)
2025-11-11 01:10:50 +0100Googulator9(~Googulato@2a01-036d-0106-0180-8127-ba79-55a7-6f29.pool6.digikabel.hu)
2025-11-11 01:10:07 +0100 <Sidney> recursion but I does not feel like the right tool. Thanks!
2025-11-11 01:10:07 +0100 <Sidney> Hi, I am trying to learn how to think in the Haskell way (I don't know the precise term), but I am having difficultly solving leetcode problem which require stateful operations such as problems which requires the two pointers technique. Is there pattern/mindset to solve inherently stateful problems elegantly and with good time complexity? I tried
2025-11-11 01:08:49 +0100Sidney(~Sidney@2600:4040:2678:9600:b1c4:ced3:242d:1252)
2025-11-11 01:08:31 +0100hiredman(~hiredman@frontier1.downey.family) hiredman
2025-11-11 01:07:13 +0100hiredman(~hiredman@frontier1.downey.family) (Ping timeout: 264 seconds)
2025-11-11 01:05:44 +0100Googulator21(~Googulato@2a01-036d-0106-0180-8127-ba79-55a7-6f29.pool6.digikabel.hu) (Quit: Client closed)
2025-11-11 01:05:40 +0100Googulator30(~Googulato@2a01-036d-0106-0180-8127-ba79-55a7-6f29.pool6.digikabel.hu)
2025-11-11 01:05:35 +0100anselmschueler(~Thunderbi@user/schuelermine) (Remote host closed the connection)
2025-11-11 01:03:36 +0100malte(~malte@mal.tc) malte
2025-11-11 01:02:36 +0100Anarchos(~Anarchos@91-161-254-16.subs.proxad.net) (Quit: Vision[]: i've been blurred!)
2025-11-11 00:58:19 +0100malte(~malte@mal.tc) (Remote host closed the connection)
2025-11-11 00:57:53 +0100Square3(~Square@user/square) Square
2025-11-11 00:55:25 +0100haltingsolver(~cmo@2604:3d09:207f:8000::d1dc)
2025-11-11 00:55:13 +0100merijn(~merijn@host-vr.cgnat-g.v4.dfn.nl) (Ping timeout: 256 seconds)
2025-11-11 00:50:11 +0100merijn(~merijn@host-vr.cgnat-g.v4.dfn.nl) merijn
2025-11-11 00:42:53 +0100lisbeths(uid135845@id-135845.lymington.irccloud.com) (Quit: Connection closed for inactivity)
2025-11-11 00:32:33 +0100Anarchos(~Anarchos@91-161-254-16.subs.proxad.net) Anarchos