Logs: liberachat/#haskell
| 2021-06-05 18:09:26 | → | Sgeo joins (~Sgeo@user/sgeo) |
| 2021-06-05 18:09:57 | → | pierrot joins (~pi@user/pierrot) |
| 2021-06-05 18:10:19 | <ski> | no (see "vaporware") |
| 2021-06-05 18:12:09 | × | ddellacosta quits (~ddellacos@89.46.62.209) (Ping timeout: 268 seconds) |
| 2021-06-05 18:12:50 | × | justsomeguy quits (~justsomeg@user/justsomeguy) (Ping timeout: 245 seconds) |
| 2021-06-05 18:13:11 | → | danidiaz1 joins (~ESDPC@137.101.155.105) |
| 2021-06-05 18:14:58 | <safinaskar> | ski: ok :( |
| 2021-06-05 18:15:19 | × | danidiaz quits (~ESDPC@137.101.155.105) (Ping timeout: 272 seconds) |
| 2021-06-05 18:18:56 | × | ddellaco_ quits (~ddellacos@89.45.224.79) (Ping timeout: 268 seconds) |
| 2021-06-05 18:19:19 | → | ddellacosta joins (~ddellacos@89.46.62.183) |
| 2021-06-05 18:19:59 | → | tzh joins (~tzh@c-24-21-73-154.hsd1.wa.comcast.net) |
| 2021-06-05 18:21:01 | → | ddellaco_ joins (~ddellacos@89.45.224.222) |
| 2021-06-05 18:23:23 | × | ddellaco_ quits (~ddellacos@89.45.224.222) (Remote host closed the connection) |
| 2021-06-05 18:23:41 | → | ddellaco_ joins (~ddellacos@89.45.224.222) |
| 2021-06-05 18:24:10 | → | GuerrillaMonkey joins (~Jeanne-Ka@static-198-54-128-61.cust.tzulo.com) |
| 2021-06-05 18:24:18 | × | ddellacosta quits (~ddellacos@89.46.62.183) (Ping timeout: 264 seconds) |
| 2021-06-05 18:27:50 | × | Jeanne-Kamikaze quits (~Jeanne-Ka@static-198-54-133-135.cust.tzulo.com) (Ping timeout: 245 seconds) |
| 2021-06-05 18:30:27 | × | UpstreamSalmon quits (uid12077@id-12077.stonehaven.irccloud.com) (Quit: Connection closed for inactivity) |
| 2021-06-05 18:30:31 | × | arjun quits (~user@user/arjun) (Ping timeout: 272 seconds) |
| 2021-06-05 18:30:36 | × | dunkeln quits (~dunkeln@94.129.65.28) (Ping timeout: 265 seconds) |
| 2021-06-05 18:32:08 | → | merijn joins (~merijn@83-160-49-249.ip.xs4all.nl) |
| 2021-06-05 18:33:54 | <ski> | (and i'm pretty sure those banana brackets are entirely unrelated to what you wanted) |
| 2021-06-05 18:34:05 | × | ddellaco_ quits (~ddellacos@89.45.224.222) (Ping timeout: 245 seconds) |
| 2021-06-05 18:34:52 | → | wroathe joins (~wroathe@c-68-54-25-135.hsd1.mn.comcast.net) |
| 2021-06-05 18:35:36 | → | ddellacosta joins (~ddellacos@89.45.224.222) |
| 2021-06-05 18:36:51 | × | leungbk quits (~user@cpe-142-129-149-172.socal.res.rr.com) (Ping timeout: 272 seconds) |
| 2021-06-05 18:40:20 | × | ddellacosta quits (~ddellacos@89.45.224.222) (Ping timeout: 245 seconds) |
| 2021-06-05 18:41:49 | → | v01d4lph4 joins (~v01d4lph4@122.160.65.250) |
| 2021-06-05 18:41:49 | × | v01d4lph4 quits (~v01d4lph4@122.160.65.250) (Changing host) |
| 2021-06-05 18:41:49 | → | v01d4lph4 joins (~v01d4lph4@user/v01d4lph4) |
| 2021-06-05 18:42:11 | × | v01d4lph4 quits (~v01d4lph4@user/v01d4lph4) (Read error: Connection reset by peer) |
| 2021-06-05 18:42:43 | × | aplainzetakind quits (~johndoe@captainludd.powered.by.lunarbnc.net) (Quit: Free ZNC ~ Powered by LunarBNC: https://LunarBNC.net) |
| 2021-06-05 18:42:50 | → | ddellacosta joins (~ddellacos@89.46.62.25) |
| 2021-06-05 18:43:09 | → | aplainzetakind joins (~johndoe@captainludd.powered.by.lunarbnc.net) |
| 2021-06-05 18:43:53 | × | aplainzetakind quits (~johndoe@captainludd.powered.by.lunarbnc.net) (Client Quit) |
| 2021-06-05 18:44:19 | → | aplainzetakind joins (~johndoe@captainludd.powered.by.lunarbnc.net) |
| 2021-06-05 18:45:09 | → | justsomeguy joins (~justsomeg@user/justsomeguy) |
| 2021-06-05 18:46:51 | × | chexum quits (~chexum@2a02:a03f:62f9:3f00:6b71:476f:e71b:80b) (Quit: -) |
| 2021-06-05 18:47:28 | → | chexum joins (~chexum@2a02:a03f:62f9:3f00:6b71:476f:e71b:80b) |
| 2021-06-05 18:48:06 | × | eggplant_ quits (~Eggplanta@2600:1700:bef1:5e10:e061:bfad:5c85:da98) (Remote host closed the connection) |
| 2021-06-05 18:48:53 | → | ddellaco_ joins (~ddellacos@86.106.143.53) |
| 2021-06-05 18:48:57 | → | Guest33 joins (~Guest33@d24-141-46-200.home.cgocable.net) |
| 2021-06-05 18:49:32 | <Guest33> | Hi guys, I'm stuck with a problem and I need some help if anyone can give me some direction. |
| 2021-06-05 18:50:22 | <Guest33> | How would I remove the 1 in [1,2] from the following [(Node {getNodeID = 0, getNodeVal = 'A'},[1,2]),(Node {getNodeID = 2, getNodeVal = 'C'},[1,2])] |
| 2021-06-05 18:50:50 | <Guest33> | and return the modified list |
| 2021-06-05 18:51:10 | × | ddellacosta quits (~ddellacos@89.46.62.25) (Ping timeout: 245 seconds) |
| 2021-06-05 18:51:25 | × | malvo quits (~malvo@malvo.org) (Ping timeout: 272 seconds) |
| 2021-06-05 18:51:31 | <boxscape> | i.e, remove it in both elements and get [(Node {getNodeID = 0, getNodeVal = 'A'},[1]),(Node {getNodeID = 2, getNodeVal = 'C'},[1])]? |
| 2021-06-05 18:51:39 | <boxscape> | err |
| 2021-06-05 18:51:44 | × | chexum quits (~chexum@2a02:a03f:62f9:3f00:6b71:476f:e71b:80b) (Client Quit) |
| 2021-06-05 18:51:48 | <boxscape> | [(Node {getNodeID = 0, getNodeVal = 'A'},[2]),(Node {getNodeID = 2, getNodeVal = 'C'},[2])]? |
| 2021-06-05 18:51:51 | <boxscape> | is that the goal? |
| 2021-06-05 18:51:55 | <Guest33> | no get [2] ya |
| 2021-06-05 18:52:05 | <boxscape> | are you familiar with fmap? |
| 2021-06-05 18:52:21 | → | chexum joins (~chexum@2a02:a03f:62f9:3f00:6b71:476f:e71b:80b) |
| 2021-06-05 18:52:37 | <Guest33> | I was playing around with it but it keeps giving me [[2]] instead of the modified list (sorry i'm very new to this) |
| 2021-06-05 18:53:25 | <boxscape> | do you remember what you were writing that gave [[2]]? |
| 2021-06-05 18:54:41 | × | chexum quits (~chexum@2a02:a03f:62f9:3f00:6b71:476f:e71b:80b) (Client Quit) |
| 2021-06-05 18:54:54 | → | ddellacosta joins (~ddellacos@107.182.237.15) |
| 2021-06-05 18:55:00 | <Guest33> | my bad that was for another function where I was inserting an edge. |
| 2021-06-05 18:55:10 | <Guest33> | fmap (\x -> snd(x) ++ [3]) (filter (\n -> getNodeID (fst (n)) == 0 ) exGraph) |
| 2021-06-05 18:55:18 | <Guest33> | gives [[1,2,3]] |
| 2021-06-05 18:55:36 | <Guest33> | but I want [(Node {getNodeID = 0, getNodeVal = 'A'},[1,2,3]),(Node {getNodeID = 2, getNodeVal = 'C'},[1])] |
| 2021-06-05 18:56:00 | × | Scotty_Trees quits (~Scotty_Tr@162-234-179-169.lightspeed.brhmal.sbcglobal.net) (Quit: Leaving) |
| 2021-06-05 18:56:32 | <Guest33> | I guess if I can figure out any one of them I can get both :D |
| 2021-06-05 18:56:42 | <boxscape> | hm so you want to append 3 to the list in the first element of the outer list and remove the 2 from the second one? |
| 2021-06-05 18:56:50 | → | _73 joins (~user@pool-96-252-123-136.bstnma.fios.verizon.net) |
| 2021-06-05 18:57:29 | <Guest33> | just append 3 to the list in the first element is fine for now |
| 2021-06-05 18:57:43 | <boxscape> | will the outer list always have two elements? |
| 2021-06-05 18:59:05 | × | ddellacosta quits (~ddellacos@107.182.237.15) (Ping timeout: 245 seconds) |
| 2021-06-05 18:59:11 | <Guest33> | no it can change vary but (filter (\n -> getNodeID (fst (n)) == 0 ) exGraph) .. the == 0 make sure I choose the element with nodeID = 0in the outer list |
| 2021-06-05 18:59:42 | <boxscape> | ah, hm |
| 2021-06-05 19:00:57 | <_73> | I am trying to figure out how to express a typeclass for memory. I have different Memory types that are essentially data structures holding key value pairs that I read and write. I am trying to figure out how to abstract out this pattern. I am thinking that multi-param-typeclasses would be useful. The reason I thought to use multi-param-typeclasses is that they could allow me to restrict the type of the arguments to the typeclass |
| 2021-06-05 19:00:57 | <_73> | functions so they allign with the types of the keys and values. I would like help trying to figure what it is that I need here: http://dpaste.com/CKN26MCE3 |
| 2021-06-05 19:01:08 | <boxscape> | you can map over the list and inside the map function make sure you only change the element that is 0, i.e. `map (\(Node id val, xs)-> Node id (if id /= 0 then val else <a modified version of xs>))`, Guest33 |
| 2021-06-05 19:01:35 | ← | jakalx parts (~jakalx@base.jakalx.net) (Error from remote client) |
| 2021-06-05 19:01:36 | <boxscape> | er, that should be `if id /= 0 then xs else <a modified version of xs>` |
| 2021-06-05 19:01:36 | <Guest33> | Let me try. Thank you in advance!! |
| 2021-06-05 19:02:08 | → | reumeth joins (~reumeth@user/reumeth) |
| 2021-06-05 19:02:09 | <_73> | I am starting to realize that my memory types, (like MyMemory) are really just type aliases. Does this suggest I could abstract my types further somehow? |
| 2021-06-05 19:04:02 | <boxscape> | Guest33 actually I still got it wrong: map (\(Node id val, xs)-> (Node id val, (if id /= 0 then val else <a modified version of xs>))) |
| 2021-06-05 19:04:20 | × | Bartosz quits (~textual@24.35.90.211) (Quit: My MacBook has gone to sleep. ZZZzzz…) |
| 2021-06-05 19:04:26 | <boxscape> | nope, now I forgot to apply the first correction, the `val` in the if should be `id` :) |
| 2021-06-05 19:04:38 | <boxscape> | err, no, it should be xs |
| 2021-06-05 19:06:18 | × | merijn quits (~merijn@83-160-49-249.ip.xs4all.nl) (Ping timeout: 244 seconds) |
| 2021-06-05 19:07:51 | <boxscape> | _73 looks like you need instance Memory MyMemory Integer String where |
| 2021-06-05 19:08:47 | → | jakalx joins (~jakalx@base.jakalx.net) |
| 2021-06-05 19:08:49 | → | Bartosz joins (~textual@24.35.90.211) |
| 2021-06-05 19:09:37 | × | bollu quits (~bollu@139.59.46.74) (Quit: Ping timeout (120 seconds)) |
| 2021-06-05 19:09:45 | <Guest33> | boxscape so I did map (\(Node id val, xs) -> if id /= 0 then xs else xs ++ [3]) exGraph and it gives me [[1,2,3],[],[1,2]] where exGraph = [(Node {getNodeID = 0, getNodeVal = 'A'},[1,2]),(Node {getNodeID = 1, getNodeVal = 'B'},[]),(Node {getNodeID = 2, getNodeVal = 'C'},[1,2])] |
| 2021-06-05 19:09:53 | → | bollu joins (~bollu@139.59.46.74) |
| 2021-06-05 19:10:02 | → | chexum joins (~chexum@gateway/tor-sasl/chexum) |
| 2021-06-05 19:10:10 | <Guest33> | I wanted [(Node {getNodeID = 0, getNodeVal = 'A'},[1,2,3]),(Node {getNodeID = 1, getNodeVal = 'B'},[]),(Node {getNodeID = 2, getNodeVal = 'C'},[1,2])] |
| 2021-06-05 19:10:13 | × | fendor quits (~fendor@91.141.0.144.wireless.dyn.drei.com) (Remote host closed the connection) |
| 2021-06-05 19:10:53 | <Guest33> | basically it's working but not giving me the first modified list but the inner list |
| 2021-06-05 19:11:01 | <boxscape> | Guest33 so, in the body of the lambda expression you only have the if statement, you're not returning the actual node. You can write `\(Node id val, xs) -> (Node id val, if id /= 0 then xs else xs ++ [3])`, or, perhaps slightly better, \(node@(Node id val), xs) -> (node, if id /= 0 then xs else xs ++ [3]) |
| 2021-06-05 19:11:26 | <_73> | boxscape: Illegel instance declaration for 'Memory MyMemory Integer String' ... my question is more about if what I am doing makes sense, rather than how to get this to actually work with MultiParamTypeClasses. I feel like what I am doing is slightly missing the point somehow. |
| 2021-06-05 19:12:30 | × | wroathe quits (~wroathe@c-68-54-25-135.hsd1.mn.comcast.net) (Ping timeout: 244 seconds) |
| 2021-06-05 19:13:36 | → | fizbin joins (~fizbin@c-73-33-197-160.hsd1.nj.comcast.net) |
| 2021-06-05 19:13:47 | → | ddellacosta joins (~ddellacos@86.106.121.100) |
All times are in UTC.