2025/12/02

Newest at the top

2025-12-02 11:40:19 +0100haritz(~hrtz@user/haritz) haritz
2025-12-02 11:40:19 +0100haritz(~hrtz@140.228.70.141) (Changing host)
2025-12-02 11:40:19 +0100haritz(~hrtz@140.228.70.141)
2025-12-02 11:39:43 +0100tromp(~textual@2001:1c00:3487:1b00:4073:6a24:b181:8b56) (Quit: My iMac has gone to sleep. ZZZzzz…)
2025-12-02 11:38:49 +0100 <Leary> Or flip the args and call it `forA`, even better.
2025-12-02 11:38:39 +0100 <Leary> kuribas: How about `foldA :: (Foldable t, Applicative f, Monoid b) => (a -> f b) -> t a -> f b; foldA f = getAp . foldMap (Ap . f)`? `f` can be `State s`, `b` can be a list ...
2025-12-02 11:37:35 +0100vgtw(~vgtw@user/vgtw) vgtw
2025-12-02 11:37:35 +0100comerijn(~merijn@77.242.116.146) (Ping timeout: 240 seconds)
2025-12-02 11:37:15 +0100vgtw(~vgtw@user/vgtw) (Ping timeout: 240 seconds)
2025-12-02 11:32:23 +0100 <tomsmeding> oh
2025-12-02 11:32:15 +0100 <kuribas> I forgot a colon.
2025-12-02 11:32:04 +0100 <tomsmeding> then what's github's syntax highlighter up about
2025-12-02 11:31:51 +0100 <tomsmeding> oh right
2025-12-02 11:31:42 +0100 <tomsmeding> is it?
2025-12-02 11:31:38 +0100 <kuribas> elif is valid python
2025-12-02 11:31:31 +0100 <tomsmeding> (= instead of ==, elif instead of else if)
2025-12-02 11:31:18 +0100 <kuribas> actually I have
2025-12-02 11:31:05 +0100 <tomsmeding> although the 'break' may be tricky
2025-12-02 11:30:56 +0100 <tomsmeding> I see you haven't been programming python recently with the syntax errors, but otherwise yes :p
2025-12-02 11:30:24 +0100vgtw(~vgtw@user/vgtw) vgtw
2025-12-02 11:29:42 +0100 <kuribas> python would be something like this: https://gist.github.com/kuribas/bfeb96b35699d6a4f64b50f4732d62b9
2025-12-02 11:27:22 +0100vgtw(~vgtw@user/vgtw) (Ping timeout: 246 seconds)
2025-12-02 11:26:06 +0100 <tomsmeding> I don't think it's Haskell :p
2025-12-02 11:25:59 +0100 <tomsmeding> my knowledge of funny programming languages is not large enough to be able to point to which one, but I feel like there's a language where this would be the "neat" solution
2025-12-02 11:25:35 +0100 <kuribas> I just feel like all of this is more complicated than equivalent python.
2025-12-02 11:25:15 +0100 <kuribas> yes
2025-12-02 11:24:45 +0100 <tomsmeding> and 'send out' the aliases to the coroutine via a channel?
2025-12-02 11:24:43 +0100acidjnk(~acidjnk@p200300d6e71719443da791614ae70cbb.dip0.t-ipconnect.de) acidjnk
2025-12-02 11:24:34 +0100xff0x(~xff0x@fsb6a9491c.tkyc517.ap.nuro.jp) (Ping timeout: 246 seconds)
2025-12-02 11:24:19 +0100 <kuribas> Another interesting solution would be to use coroutines, and have one routine for generating the tables aliases.
2025-12-02 11:22:45 +0100 <tomsmeding> anyway this is a function that I needed at some point and couldn't find in the standard libraries
2025-12-02 11:22:21 +0100 <tomsmeding> the state is already there, lol
2025-12-02 11:22:13 +0100 <tomsmeding> uh, no, don't instantiate m to State
2025-12-02 11:21:00 +0100vgtw(~vgtw@user/vgtw) vgtw
2025-12-02 11:20:47 +0100Googulator26(~Googulato@2a01-036d-0106-4ad8-d9ec-010d-f188-ffcb.pool6.digikabel.hu)
2025-12-02 11:20:37 +0100Googulator26(~Googulato@2a01-036d-0106-4ad8-d9ec-010d-f188-ffcb.pool6.digikabel.hu) (Quit: Client closed)
2025-12-02 11:20:06 +0100 <tomsmeding> note the swap because mapAccumL and runState do not agree on which part of the pair should go which way :p
2025-12-02 11:19:21 +0100 <tomsmeding> instantiate m to State and roll
2025-12-02 11:19:10 +0100 <kuribas> tomsmeding: yes :)
2025-12-02 11:18:43 +0100 <tomsmeding> this? https://paste.tomsmeding.com/r70Fuwb3
2025-12-02 11:18:24 +0100 <kuribas> yeah
2025-12-02 11:18:14 +0100CiaoSen(~Jura@2a02:8071:64e1:da0:5a47:caff:fe78:33db) CiaoSen
2025-12-02 11:18:14 +0100 <tomsmeding> is it that you want to loop over a list with some state, and while doing so, generate values to be stored in a returned list at the end?
2025-12-02 11:17:46 +0100 <kuribas> tomsmeding: I just wanted to use bind (>>=), but with a monad stack. Like a list comprehension with state.
2025-12-02 11:17:16 +0100 <tomsmeding> or "cartesian product of the possibilities"
2025-12-02 11:16:58 +0100 <tomsmeding> kuribas: I don't see how ListT is relevant here, but then I don't really understand your usecase yet; ListT is for nondeterminism
2025-12-02 11:16:44 +0100vgtw(~vgtw@user/vgtw) (Ping timeout: 244 seconds)
2025-12-02 11:16:42 +0100 <lambdabot> (Num [a1], Traversable t) => (a2 -> [a1] -> Identity (b, [a1])) -> t a2 -> [a1]
2025-12-02 11:16:41 +0100 <kuribas> :t \f l -> concat $ flip runState 1 $ traverse (StateT . f) l
2025-12-02 11:16:18 +0100marinelli(~weechat@gateway/tor-sasl/marinelli) marinelli