2024/04/23

Newest at the top

2024-04-23 17:56:02 +0200SurfBlueCrab(~SurfBlueC@nyc.nanobit.org) (Leaving)
2024-04-23 17:55:25 +0200yin(~yin@user/zero) (Ping timeout: 256 seconds)
2024-04-23 17:51:56 +0200EvanR(~EvanR@user/evanr)
2024-04-23 17:51:37 +0200EvanR(~EvanR@user/evanr) (Remote host closed the connection)
2024-04-23 17:51:28 +0200 <Guest13> folder concat zip
2024-04-23 17:51:23 +0200 <Guest13> I repeat a lot of concat zip stuff for indexing
2024-04-23 17:51:13 +0200 <Guest13> thank you for the help! I think my code will be a lot cleaner after defining better type and helper functions
2024-04-23 17:50:44 +0200nschoe(~nschoe@2a01:e0a:8e:a190:f3a1:c501:e8bd:2571)
2024-04-23 17:50:27 +0200nschoe(~nschoe@2a01:e0a:8e:a190:1a14:5923:b0ce:d13e) (Quit: ZNC 1.8.2 - https://znc.in)
2024-04-23 17:49:58 +0200pastly(~pastly@gateway/tor-sasl/pastly) (Remote host closed the connection)
2024-04-23 17:49:08 +0200 <EvanR> in larger projects it can help catch type mismatches
2024-04-23 17:48:48 +0200 <EvanR> newtype might add bureaucracy that is not worth it in this case
2024-04-23 17:48:12 +0200 <EvanR> 👍
2024-04-23 17:48:00 +0200 <Guest13> not sure if I should new type or type, still not clear on that one
2024-04-23 17:47:47 +0200 <Guest13> type Grid = Map (Int, Int) Tile
2024-04-23 17:47:19 +0200 <Guest13> I will update the code to use Map
2024-04-23 17:45:51 +0200 <c_wraith> there's nothing to be afraid of
2024-04-23 17:45:48 +0200 <Guest13> and this seems like a prime case of skill issue
2024-04-23 17:45:44 +0200 <c_wraith> you can't fail to update one.
2024-04-23 17:45:36 +0200 <Guest13> I should change it though, I'm doing AOC to get better at Haskell mainly
2024-04-23 17:45:33 +0200 <c_wraith> but the compiler will point you at every one of them
2024-04-23 17:45:17 +0200 <Guest13> I am worried because I have a lot of functions that will break
2024-04-23 17:45:12 +0200pavonia(~user@user/siracusa) (Quit: Bye!)
2024-04-23 17:44:57 +0200 <c_wraith> Guest13: you might be surprised how little time it takes to change a data structure. this is a thing Haskell is really good at
2024-04-23 17:44:55 +0200 <Guest13> yeah with a map I could just fold on the list of indices it would be so easy
2024-04-23 17:44:34 +0200 <EvanR> for AOC it's usually more convenient than an array
2024-04-23 17:44:05 +0200 <EvanR> unlike Map or total map
2024-04-23 17:43:58 +0200 <EvanR> usually 2D array is not perfect, because it makes you decide the dimensions ahead of time
2024-04-23 17:43:49 +0200 <Guest13> cool kids use maps and folds
2024-04-23 17:43:41 +0200danse-nr3(~danse-nr3@151.47.250.177)
2024-04-23 17:43:36 +0200 <Guest13> 2d array is perfect for it, but indexing seems to be for losers in haskell
2024-04-23 17:43:13 +0200 <Guest13> next time I see a problem like this I will think more about data than functions
2024-04-23 17:42:48 +0200euleritian(~euleritia@dynamic-176-006-018-204.176.6.pool.telefonica.de)
2024-04-23 17:42:44 +0200danse-nr3(~danse-nr3@151.37.229.99) (Read error: Connection reset by peer)
2024-04-23 17:42:27 +0200 <Guest13> I have something like dfs :: Maze -> Set.Set Position -> Set.Set Position -> [Position] -> [Position]
2024-04-23 17:42:23 +0200 <Guest13> yeah my code is really ugly
2024-04-23 17:41:56 +0200 <EvanR> it helps separate reusable code from problem-at-hand code
2024-04-23 17:41:15 +0200 <EvanR> but whether you use a list or a Map, it would be a good pattern
2024-04-23 17:41:04 +0200 <EvanR> which you might be trying to avoid here
2024-04-23 17:41:03 +0200 <Guest13> I just liked that I could transpose it I thought it helped a lot
2024-04-23 17:40:58 +0200 <EvanR> another pattern is to have your data structure and a set of functions to operate on it
2024-04-23 17:40:40 +0200 <Guest13> bad design choice that is causing me a lot of pain, because zipping the 2d list is not that easy yet I'm still new to haskell
2024-04-23 17:40:29 +0200euleritian(~euleritia@ip4d16fc38.dynamic.kabel-deutschland.de) (Ping timeout: 272 seconds)
2024-04-23 17:40:12 +0200 <Guest13> and type Maze = [[Tile]]
2024-04-23 17:40:05 +0200 <Guest13> I have something like data Tile = Pipe Char | Empty deriving(Show, Eq)
2024-04-23 17:39:52 +0200 <EvanR> aka `total map'
2024-04-23 17:39:38 +0200 <EvanR> for default entries in a grid, you don't even need to store anything, just consider "nothing there" as the default value
2024-04-23 17:39:33 +0200 <Guest13> or the previous one was easy enough where it didn't matter
2024-04-23 17:39:21 +0200 <Guest13> its the first grid problem
2024-04-23 17:39:14 +0200 <Guest13> yeah I made a mistake at the start by using list like this because I didn't know it wouldn't be a good idea for a grid