| 2025-11-11 00:00:58 +0100 | emmanuelux | (~emmanuelu@user/emmanuelux) emmanuelux |
| 2025-11-11 00:01:04 +0100 | tromp | (~textual@2001:1c00:3487:1b00:5862:9c78:2f27:3ade) (Quit: My iMac has gone to sleep. ZZZzzz…) |
| 2025-11-11 00:01:25 +0100 | CiaoSen | (~Jura@2a02:8071:64e1:da0:5a47:caff:fe78:33db) (Ping timeout: 240 seconds) |
| 2025-11-11 00:06:27 +0100 | bggd | (~bgg@2a01:e0a:819:1510:285c:2d19:95b6:2c5) (Quit: std::move) |
| 2025-11-11 00:16:01 +0100 | anselmschueler | (~Thunderbi@user/schuelermine) schuelermine |
| 2025-11-11 00:18:37 +0100 | mreh | (~matthew@host86-146-25-125.range86-146.btcentralplus.com) (Ping timeout: 244 seconds) |
| 2025-11-11 00:23:38 +0100 | shr\ke | (~shrike@user/shrke:31298) (Remote host closed the connection) |
| 2025-11-11 00:29:31 +0100 | peterbecich | (~Thunderbi@172.222.148.214) peterbecich |
| 2025-11-11 00:31:14 +0100 | gmg | (~user@user/gehmehgeh) (Remote host closed the connection) |
| 2025-11-11 00:31:14 +0100 | ec | (~ec@gateway/tor-sasl/ec) (Remote host closed the connection) |
| 2025-11-11 00:31:46 +0100 | Ranhir | (~Ranhir@157.97.53.139) (Quit: KVIrc 5.2.6 Quasar http://www.kvirc.net/) |
| 2025-11-11 00:31:47 +0100 | ec | (~ec@gateway/tor-sasl/ec) ec |
| 2025-11-11 00:31:55 +0100 | gmg | (~user@user/gehmehgeh) gehmehgeh |
| 2025-11-11 00:32:28 +0100 | Ranhir | (~Ranhir@157.97.53.139) Ranhir |
| 2025-11-11 00:32:33 +0100 | Anarchos | (~Anarchos@91-161-254-16.subs.proxad.net) Anarchos |
| 2025-11-11 00:42:53 +0100 | lisbeths | (uid135845@id-135845.lymington.irccloud.com) (Quit: Connection closed for inactivity) |
| 2025-11-11 00:50:11 +0100 | merijn | (~merijn@host-vr.cgnat-g.v4.dfn.nl) merijn |
| 2025-11-11 00:55:13 +0100 | merijn | (~merijn@host-vr.cgnat-g.v4.dfn.nl) (Ping timeout: 256 seconds) |
| 2025-11-11 00:55:25 +0100 | haltingsolver | (~cmo@2604:3d09:207f:8000::d1dc) |
| 2025-11-11 00:57:53 +0100 | Square3 | (~Square@user/square) Square |
| 2025-11-11 00:58:19 +0100 | malte | (~malte@mal.tc) (Remote host closed the connection) |
| 2025-11-11 01:02:36 +0100 | Anarchos | (~Anarchos@91-161-254-16.subs.proxad.net) (Quit: Vision[]: i've been blurred!) |
| 2025-11-11 01:03:36 +0100 | malte | (~malte@mal.tc) malte |
| 2025-11-11 01:05:35 +0100 | anselmschueler | (~Thunderbi@user/schuelermine) (Remote host closed the connection) |
| 2025-11-11 01:05:40 +0100 | Googulator30 | (~Googulato@2a01-036d-0106-0180-8127-ba79-55a7-6f29.pool6.digikabel.hu) |
| 2025-11-11 01:05:44 +0100 | Googulator21 | (~Googulato@2a01-036d-0106-0180-8127-ba79-55a7-6f29.pool6.digikabel.hu) (Quit: Client closed) |
| 2025-11-11 01:07:13 +0100 | hiredman | (~hiredman@frontier1.downey.family) (Ping timeout: 264 seconds) |
| 2025-11-11 01:08:31 +0100 | hiredman | (~hiredman@frontier1.downey.family) hiredman |
| 2025-11-11 01:08:49 +0100 | Sidney | (~Sidney@2600:4040:2678:9600:b1c4:ced3:242d:1252) |
| 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:10:07 +0100 | <Sidney> | recursion but I does not feel like the right tool. Thanks! |
| 2025-11-11 01:10:50 +0100 | Googulator9 | (~Googulato@2a01-036d-0106-0180-8127-ba79-55a7-6f29.pool6.digikabel.hu) |
| 2025-11-11 01:11:16 +0100 | Googulator30 | (~Googulato@2a01-036d-0106-0180-8127-ba79-55a7-6f29.pool6.digikabel.hu) (Quit: Client closed) |
| 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:18:18 +0100 | sprout | (~sprout@84-80-106-227.fixed.kpn.net) sprout |
| 2025-11-11 01:29:25 +0100 | peterbecich | (~Thunderbi@172.222.148.214) (Ping timeout: 240 seconds) |
| 2025-11-11 01:31:07 +0100 | comonad | (~comonad@2003:d0:2741:a000:c693:4c09:e8b4:6dfd) |
| 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:37:18 +0100 | ttybitnik | (~ttybitnik@user/wolper) (Quit: Fading out...) |
| 2025-11-11 01:40:42 +0100 | Googulator9 | (~Googulato@2a01-036d-0106-0180-8127-ba79-55a7-6f29.pool6.digikabel.hu) (Quit: Client closed) |
| 2025-11-11 01:40:47 +0100 | Googulator65 | (~Googulato@2a01-036d-0106-0180-8127-ba79-55a7-6f29.pool6.digikabel.hu) |
| 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:41:57 +0100 | <EvanR> | (or IntMap A) |
| 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:44:43 +0100 | <EvanR> | another way is to use a State monad, there are other ways |
| 2025-11-11 01:44:48 +0100 | gf3 | (~gf3@user/gf3) (Ping timeout: 256 seconds) |
| 2025-11-11 01:47:40 +0100 | Tuplanolla | (~Tuplanoll@91-159-187-167.elisa-laajakaista.fi) (Quit: Leaving.) |
| 2025-11-11 01:48:14 +0100 | gf3 | (~gf3@user/gf3) gf3 |
| 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: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: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:59:58 +0100 | <Sidney> | complexity without a for loop and a hash table. |
| 2025-11-11 02:00:18 +0100 | jle` | (~jle`@2603:8001:3b00:11:5098:4041:9bc7:9b0d) (Ping timeout: 244 seconds) |
| 2025-11-11 02:00:31 +0100 | Googulator65 | (~Googulato@2a01-036d-0106-0180-8127-ba79-55a7-6f29.pool6.digikabel.hu) (Quit: Client closed) |
| 2025-11-11 02:00:39 +0100 | Googulator65 | (~Googulato@2a01-036d-0106-0180-8127-ba79-55a7-6f29.pool6.digikabel.hu) |
| 2025-11-11 02:00:47 +0100 | spew | (~spew@user/spew) spew |
| 2025-11-11 02:01:30 +0100 | jle` | (~jle`@2603:8001:3b00:11:c2d0:7f27:fab9:22ae) jle` |
| 2025-11-11 02:04:29 +0100 | xff0x | (~xff0x@2405:6580:b080:900:2473:b259:8788:143a) (Ping timeout: 260 seconds) |
| 2025-11-11 02:05:43 +0100 | Googulator65 | (~Googulato@2a01-036d-0106-0180-8127-ba79-55a7-6f29.pool6.digikabel.hu) (Quit: Client closed) |
| 2025-11-11 02:05:50 +0100 | Googulator91 | (~Googulato@2a01-036d-0106-0180-8127-ba79-55a7-6f29.pool6.digikabel.hu) |
| 2025-11-11 02:05:53 +0100 | Sidney | (~Sidney@2600:4040:2678:9600:b1c4:ced3:242d:1252) (Ping timeout: 250 seconds) |
| 2025-11-11 02:07:16 +0100 | Sidney | (~Sidney@2600:4040:2678:9600:b1c4:ced3:242d:1252) |
| 2025-11-11 02:10:50 +0100 | Googulator91 | (~Googulato@2a01-036d-0106-0180-8127-ba79-55a7-6f29.pool6.digikabel.hu) (Quit: Client closed) |
| 2025-11-11 02:10:59 +0100 | Googulator91 | (~Googulato@2a01-036d-0106-0180-8127-ba79-55a7-6f29.pool6.digikabel.hu) |
| 2025-11-11 02:15:37 +0100 | tabaqui | (~tabaqui@167.71.80.236) (Ping timeout: 264 seconds) |
| 2025-11-11 02:15:42 +0100 | Googulator83 | (~Googulato@2a01-036d-0106-0180-8127-ba79-55a7-6f29.pool6.digikabel.hu) |
| 2025-11-11 02:16:09 +0100 | Googulator91 | (~Googulato@2a01-036d-0106-0180-8127-ba79-55a7-6f29.pool6.digikabel.hu) (Quit: Client closed) |
| 2025-11-11 02:18:55 +0100 | merijn | (~merijn@host-vr.cgnat-g.v4.dfn.nl) merijn |
| 2025-11-11 02:19:28 +0100 | <mange> | Sidney: You can use recursion, building up a hash table as you go. The two sum problem, for instance, could be like this: http://paste.debian.net/1405577/ (I'm using Map because it was easier, but you can see the idea). |
| 2025-11-11 02:20:26 +0100 | <mange> | The move zeros one you linked to is explicitly about mutating an array, so obviously you can't do that without mutation. |
| 2025-11-11 02:22:45 +0100 | DetourNetworkUK | (DetourNetw@user/DetourNetworkUK) (Read error: Connection reset by peer) |
| 2025-11-11 02:22:47 +0100 | DetourNe- | (DetourNetw@user/DetourNetworkUK) DetourNetworkUK |
| 2025-11-11 02:23:26 +0100 | Starving_Drummer | (~berke@user/Starving-Drummer:76786) (Remote host closed the connection) |
| 2025-11-11 02:23:58 +0100 | <mange> | Oh, wait, sorry, I misread your message. You don't want to use a hash table. That makes sense. |
| 2025-11-11 02:24:49 +0100 | Googulator83 | (~Googulato@2a01-036d-0106-0180-8127-ba79-55a7-6f29.pool6.digikabel.hu) (Quit: Client closed) |
| 2025-11-11 02:25:04 +0100 | Googulator83 | (~Googulato@2a01-036d-0106-0180-8127-ba79-55a7-6f29.pool6.digikabel.hu) |
| 2025-11-11 02:25:04 +0100 | DetourNe- | DetourNetworkUK |
| 2025-11-11 02:25:32 +0100 | Googulator83 | (~Googulato@2a01-036d-0106-0180-8127-ba79-55a7-6f29.pool6.digikabel.hu) (Client Quit) |
| 2025-11-11 02:25:43 +0100 | Googulator83 | (~Googulato@2a01-036d-0106-0180-8127-ba79-55a7-6f29.pool6.digikabel.hu) |
| 2025-11-11 02:25:53 +0100 | merijn | (~merijn@host-vr.cgnat-g.v4.dfn.nl) (Ping timeout: 256 seconds) |
| 2025-11-11 02:28:17 +0100 | <int-e> | sorting can help with two-sum |
| 2025-11-11 02:30:36 +0100 | <int-e> | > let (xs,ys) = partition (/= 0) [0,1,0,3,12] in xs ++ ys -- yes it's not in-place, but whatever |
| 2025-11-11 02:30:37 +0100 | <lambdabot> | [1,3,12,0,0] |
| 2025-11-11 02:31:23 +0100 | spew | (~spew@user/spew) (Quit: WeeChat 4.6.3) |
| 2025-11-11 02:37:42 +0100 | merijn | (~merijn@host-vr.cgnat-g.v4.dfn.nl) merijn |