2025/01/28

Newest at the top

2025-01-28 23:09:46 +0100 <tomsmeding> ah, that's wrong. Set `data T = T A`.
2025-01-28 23:09:25 +0100 <tomsmeding> if the function goes A -> B, set T = A.
2025-01-28 23:08:58 +0100 <monochrom> Related unhelpful theorem: For every computable function, there exists an intermediate data structure T such that the function is composed of ana'ing input into T and then cata'ing T into output.
2025-01-28 23:08:43 +0100img(~img@user/img) (Ping timeout: 245 seconds)
2025-01-28 23:07:24 +0100merijn(~merijn@host-vr.cgnat-g.v4.dfn.nl) merijn
2025-01-28 23:07:19 +0100 <tomsmeding> agreed
2025-01-28 23:07:19 +0100confused_rust_en(~confused_@2603:7081:1600:6425:187f:fcc6:e582:3131)
2025-01-28 23:07:02 +0100 <int-e> The serious part though is that when figuring out algorithms on simple data structures... "what recursion scheme is this" doesn't seem like a helpful question.
2025-01-28 23:06:51 +0100 <haskellbridge> <alexfmpe> Might need some unsafe functions in there for traverse-ish if you only require Foldable
2025-01-28 23:06:18 +0100 <int-e> It does get interesting when you compose these things... one early showcase is build/foldr fusion.
2025-01-28 23:06:09 +0100img_(~img@user/img) img
2025-01-28 23:05:49 +0100 <haskellbridge> <alexfmpe> You can write all the other ones via it
2025-01-28 23:05:35 +0100 <haskellbridge> <alexfmpe> Fold *is* recursion
2025-01-28 23:05:33 +0100 <tomsmeding> I guess foldMap is a little less powerful than a full catamorphism would be
2025-01-28 23:05:06 +0100 <monochrom> I consider foldMap to be under monoidology not recursion schemes. >:)
2025-01-28 23:04:55 +0100 <mauke> map is quite useful
2025-01-28 23:04:36 +0100 <tomsmeding> int-e: foldMap is quite useful.
2025-01-28 23:03:13 +0100machinedgod(~machinedg@d108-173-18-100.abhsia.telus.net) machinedgod
2025-01-28 23:02:07 +0100 <int-e> Recursion schemes are silly; explicit recursion is underrated. Change my mind.
2025-01-28 23:00:50 +0100 <monochrom> Ah, I need to respect that. But only out of a mathematical/logical reason: In type theory with user-definable algebraic types (e.g. Agda, Lean), the auto-gen'ed induction principle is a para.
2025-01-28 22:59:43 +0100 <EvanR_> the effect of code on humans and vice versa
2025-01-28 22:59:01 +0100 <EvanR_> monochrom, stuff like recursion schemes might fall under programming geography
2025-01-28 22:57:31 +0100sawilagar(~sawilagar@user/sawilagar) (Ping timeout: 252 seconds)
2025-01-28 22:57:02 +0100Midjak(~MarciZ@82.66.147.146) (Quit: This computer has gone to sleep)
2025-01-28 22:56:39 +0100merijn(~merijn@host-vr.cgnat-g.v4.dfn.nl) (Ping timeout: 260 seconds)
2025-01-28 22:55:44 +0100tnt2tnt1
2025-01-28 22:55:44 +0100tnt1(~Thunderbi@user/tnt1) (Ping timeout: 265 seconds)
2025-01-28 22:55:06 +0100 <c_wraith> (at least in a non-strict language)
2025-01-28 22:54:58 +0100Googulator(~Googulato@2a01-036d-0106-1666-e945-fd21-b920-9aa7.pool6.digikabel.hu) (Client Quit)
2025-01-28 22:54:48 +0100 <c_wraith> monochrom: paramorphisms can be an efficiency win, even if they have the same computational power as catamorphisms.
2025-01-28 22:53:55 +0100 <tomsmeding> :)
2025-01-28 22:53:38 +0100 <haskellbridge> <thirdofmay18081814goya> thanks a lot for the example!
2025-01-28 22:53:33 +0100 <tomsmeding> to do better in terms of space usage, you'll have to augment the folder
2025-01-28 22:53:33 +0100 <haskellbridge> <thirdofmay18081814goya> hm I see
2025-01-28 22:53:16 +0100 <tomsmeding> goya: note that my code has to reconstruct the tree in the fold, even though there is already one in memory: the one we're folding over. So this returns new copies of each subtree instead of shared subtrees
2025-01-28 22:53:10 +0100 <int-e> strictly awful?
2025-01-28 22:52:42 +0100tnt2(~Thunderbi@user/tnt1) tnt1
2025-01-28 22:52:23 +0100 <monochrom> Oh! To avoid lazy evaluation, just lift to liftA2 (&&) for a suitable Applicative instance. >:)
2025-01-28 22:52:08 +0100 <tomsmeding> use Maybe instead of [] to get only the first / last / ... match
2025-01-28 22:52:03 +0100 <haskellbridge> <thirdofmay18081814goya> will be studying that example
2025-01-28 22:52:00 +0100 <haskellbridge> <thirdofmay18081814goya> oh neat
2025-01-28 22:51:38 +0100merijn(~merijn@host-vr.cgnat-g.v4.dfn.nl) merijn
2025-01-28 22:51:32 +0100 <monochrom> Stops early.
2025-01-28 22:51:31 +0100 <c_wraith> Yeah, you don't need to work for that. You need to work to avoid it.
2025-01-28 22:51:27 +0100 <lambdabot> False
2025-01-28 22:51:25 +0100 <monochrom> > foldr (&&) undefined (False : undefined)
2025-01-28 22:51:15 +0100 <tomsmeding> what monochrom says
2025-01-28 22:51:08 +0100 <monochrom> Lazy evaluation easily stops early when something is found.
2025-01-28 22:51:05 +0100 <tomsmeding> goya: https://play.haskell.org/saved/KMCLVKww
2025-01-28 22:50:47 +0100Googulator(~Googulato@2a01-036d-0106-1666-e945-fd21-b920-9aa7.pool6.digikabel.hu)