2025/12/19

Newest at the top

2025-12-19 18:02:10 +0100 <merijn> yin: I disagree, tbh :p
2025-12-19 18:01:14 +0100 <yin> prelude doesn't even help
2025-12-19 18:00:54 +0100omidmash(~omidmash@user/omidmash) (Quit: The Lounge - https://thelounge.chat)
2025-12-19 18:00:25 +0100 <yin> i mean the potential is there
2025-12-19 18:00:14 +0100 <yin> mari-estel: my idealized version of Haskell :)
2025-12-19 17:59:48 +0100 <mari-estel> yin: in comparison with?
2025-12-19 17:59:28 +0100 <yin> merijn: i'm always sad that Haskell requires so much verbosity in order to guarantee correctness
2025-12-19 17:57:15 +0100 <sprout> I would assume it works in haskell too. and even be faster due to laziness
2025-12-19 17:56:46 +0100 <sprout> milan2: it works for me, but that's egel code
2025-12-19 17:56:01 +0100 <milan2> Anyway sprout so scanl should work for 2015 d1 p2?
2025-12-19 17:55:45 +0100 <yin> hey, i did sign main
2025-12-19 17:54:43 +0100 <milan2> yin: Look yin even with type signatures! Not like yours ;)
2025-12-19 17:54:33 +0100 <yin> yes i was happy for having only 12 days to worry about this week but i got to day 8 until work swallowed my free time
2025-12-19 17:53:12 +0100 <milan2> :D
2025-12-19 17:52:51 +0100 <yin> :D
2025-12-19 17:52:46 +0100 <yin> merijn: tl;dr
2025-12-19 17:52:37 +0100 <merijn> I immediately got sidetracked by work after doing the first day this year >.>
2025-12-19 17:52:20 +0100 <merijn> yin: I always go for most readable and most correct: https://github.com/merijn/AdventOfCode/blob/master/Day1.hs
2025-12-19 17:51:14 +0100 <yin> not the most readable, one can argue
2025-12-19 17:50:19 +0100 <milan2> Lovely really few lines of code even with IO and both parts.
2025-12-19 17:48:19 +0100lambda_gibbon(~lambda_gi@208.83.175.39) (Ping timeout: 264 seconds)
2025-12-19 17:48:15 +0100 <yin> my day 1 this year: https://paste.jrvieira.com/1766162825403
2025-12-19 17:47:30 +0100 <milan2> I am glad I started with older ones.
2025-12-19 17:47:25 +0100 <yin> milan2: good on you for starting at the beginning
2025-12-19 17:45:54 +0100fp(~Thunderbi@2001-14ba-6e24-3000--198.rev.dnainternet.fi) fp
2025-12-19 17:45:32 +0100 <probie> For day 1, this year's was definitely annoying. I messed up day 1 part 2 on the first go, because I hadn't realised the values over 100 were in the data, since part 1 was all modulo 100
2025-12-19 17:43:46 +0100lambda_gibbon(~lambda_gi@208.83.175.39)
2025-12-19 17:41:30 +0100 <sprout> I just throw an exception when I am lazy
2025-12-19 17:40:54 +0100 <merijn> milan2: oh, then it's just coicidence your question seems related to this year's day 1 part 2
2025-12-19 17:40:34 +0100 <yin> oh i used scanl
2025-12-19 17:40:21 +0100 <milan2> merijn: I started from begining.
2025-12-19 17:40:18 +0100 <lambdabot> Traversable t => (s -> a -> (s, b)) -> s -> t a -> (s, t b)
2025-12-19 17:40:17 +0100 <merijn> :t mapAccumL
2025-12-19 17:40:14 +0100 <merijn> Avoiding spoilers, my implementation relied on mapAccumL
2025-12-19 17:39:48 +0100 <milan2> sprout: So scan hmmm... or maybe custom self recursive function.
2025-12-19 17:39:31 +0100 <yin> sprout: scanr, which is foldr in disguise
2025-12-19 17:39:20 +0100 <merijn> 2025 you mean? :p
2025-12-19 17:38:46 +0100 <sprout> scan will give you a list of numbers, and you can terminate when you hit -1
2025-12-19 17:38:36 +0100 <yin> fun to see that i can press ctrl-c to halt `foldl const 0 (repeat ())` in ghci but not foldl'
2025-12-19 17:37:02 +0100 <sprout> use scan
2025-12-19 17:36:45 +0100 <yin> ironically, because it wouldn't terminate
2025-12-19 17:36:24 +0100 <lambdabot> Terminated
2025-12-19 17:36:07 +0100 <yin> > foldl' const 0 (repeat ())
2025-12-19 17:35:57 +0100 <lambdabot> 0
2025-12-19 17:35:55 +0100 <yin> > foldl' const 0 [undefined]
2025-12-19 17:35:10 +0100 <milan2> Like we need definitelly left fold, and we need to stop counting as soon as we count -1.
2025-12-19 17:34:16 +0100 <milan2> Advent of Code 2015 day 1 part 2 broke me :(
2025-12-19 17:33:46 +0100 <merijn> What are you actually trying to do?
2025-12-19 17:33:25 +0100 <milan2> I probably can't so this will not work on infinite lists.
2025-12-19 17:33:15 +0100 <merijn> So you can short-circuit in skipping some evaluation of `f`, but you *have* to walk the list