Logs: liberachat/#haskell
| 2021-06-15 08:11:42 | × | shryke_ quits (~shryke@190.43.6.93.rev.sfr.net) (Ping timeout: 244 seconds) |
| 2021-06-15 08:11:45 | ← | bfrk parts (~bfrk@200116b8458419008ef2b7070d67ad87.dip.versatel-1u1.de) (Leaving) |
| 2021-06-15 08:12:01 | × | hendursaga quits (~weechat@user/hendursaga) (Ping timeout: 252 seconds) |
| 2021-06-15 08:12:13 | × | xff0x quits (~xff0x@2001:1a81:523f:a800:fe55:300e:7173:8c39) (Ping timeout: 244 seconds) |
| 2021-06-15 08:12:17 | × | nsilv quits (~nsilv@host-82-50-119-12.retail.telecomitalia.it) (Ping timeout: 272 seconds) |
| 2021-06-15 08:13:19 | → | xff0x joins (~xff0x@2001:1a81:523f:a800:1801:e3aa:b378:ead6) |
| 2021-06-15 08:14:14 | × | ccapndave quits (~ccapndave@84-73-232-220.dclient.hispeed.ch) (Quit: Leaving...) |
| 2021-06-15 08:15:36 | → | hegstal joins (~hegstal@2a02:c7f:7604:8a00:d648:1b69:add9:923) |
| 2021-06-15 08:16:02 | × | mpt quits (~tom@2a02:908:1862:49e0::5) (Ping timeout: 272 seconds) |
| 2021-06-15 08:16:14 | × | unyu quits (~pyon@user/pyon) (Ping timeout: 268 seconds) |
| 2021-06-15 08:16:58 | → | unyu joins (~pyon@user/pyon) |
| 2021-06-15 08:17:41 | × | awschnap quits (~lavaman@98.38.249.169) (Remote host closed the connection) |
| 2021-06-15 08:17:57 | → | lavaman joins (~lavaman@98.38.249.169) |
| 2021-06-15 08:17:59 | → | nsilv joins (~nsilv@host-82-50-119-12.retail.telecomitalia.it) |
| 2021-06-15 08:18:05 | × | lavaman quits (~lavaman@98.38.249.169) (Remote host closed the connection) |
| 2021-06-15 08:21:47 | → | flounders_ joins (~flounders@173.246.200.33) |
| 2021-06-15 08:23:08 | → | wonko joins (~wjc@62.115.229.50) |
| 2021-06-15 08:23:38 | × | chaosite quits (~chaosite@user/chaosite) (Ping timeout: 272 seconds) |
| 2021-06-15 08:25:30 | × | flounders quits (~flounders@173.246.200.33) (Ping timeout: 264 seconds) |
| 2021-06-15 08:29:35 | → | oxide joins (~lambda@user/oxide) |
| 2021-06-15 08:30:06 | → | kayprish joins (~kayprish@cable-188-2-229-172.dynamic.sbb.rs) |
| 2021-06-15 08:32:43 | × | slowButPresent quits (~slowButPr@user/slowbutpresent) (Quit: leaving) |
| 2021-06-15 08:36:54 | × | Jonno_FTW quits (~come@api.carswap.me) (Ping timeout: 264 seconds) |
| 2021-06-15 08:37:11 | → | ddellacosta joins (~ddellacos@86.106.143.125) |
| 2021-06-15 08:38:22 | → | delYsid joins (~user@zidpc777.tugraz.at) |
| 2021-06-15 08:38:27 | × | feetwind quits (~mike@user/feetwind) (Ping timeout: 272 seconds) |
| 2021-06-15 08:38:36 | → | Jonno_FTW joins (~come@api.carswap.me) |
| 2021-06-15 08:39:01 | → | feetwind joins (~mike@user/feetwind) |
| 2021-06-15 08:42:11 | × | azeem quits (~azeem@dynamic-adsl-78-13-238-239.clienti.tiscali.it) (Ping timeout: 244 seconds) |
| 2021-06-15 08:42:15 | × | ddellacosta quits (~ddellacos@86.106.143.125) (Ping timeout: 272 seconds) |
| 2021-06-15 08:42:47 | × | delYsid quits (~user@zidpc777.tugraz.at) (Changing host) |
| 2021-06-15 08:42:47 | → | delYsid joins (~user@user/delYsid) |
| 2021-06-15 08:43:44 | × | muto quits (~muto@d75-159-225-7.abhsia.telus.net) (Ping timeout: 244 seconds) |
| 2021-06-15 08:44:12 | → | azeem joins (~azeem@176.200.254.249) |
| 2021-06-15 08:46:03 | × | nsilv quits (~nsilv@host-82-50-119-12.retail.telecomitalia.it) (Ping timeout: 272 seconds) |
| 2021-06-15 08:47:26 | → | nschoe joins (~quassel@178.251.84.79) |
| 2021-06-15 08:47:55 | → | fishfinger joins (~fishfinge@cpc68330-cdif16-2-0-cust557.5-1.cable.virginm.net) |
| 2021-06-15 08:48:35 | → | lavaman joins (~lavaman@98.38.249.169) |
| 2021-06-15 08:51:17 | → | nsilv joins (~nsilv@host-82-50-119-12.retail.telecomitalia.it) |
| 2021-06-15 08:51:36 | × | benin036 quits (~benin@106.198.88.131) (Read error: Connection reset by peer) |
| 2021-06-15 08:53:24 | × | lavaman quits (~lavaman@98.38.249.169) (Ping timeout: 272 seconds) |
| 2021-06-15 08:53:50 | → | benin036 joins (~benin@183.82.204.171) |
| 2021-06-15 08:54:37 | × | econo quits (uid147250@user/econo) (Quit: Connection closed for inactivity) |
| 2021-06-15 08:57:50 | × | nsilv quits (~nsilv@host-82-50-119-12.retail.telecomitalia.it) (Ping timeout: 272 seconds) |
| 2021-06-15 08:59:34 | → | nsilv joins (~nsilv@212.103.198.210) |
| 2021-06-15 08:59:50 | → | cods joins (~fred@82-65-232-44.subs.proxad.net) |
| 2021-06-15 09:03:13 | × | yd502 quits (~yd502@180.168.212.6) (Read error: Connection reset by peer) |
| 2021-06-15 09:03:27 | → | yd502 joins (~yd502@180.168.212.6) |
| 2021-06-15 09:05:57 | × | azeem quits (~azeem@176.200.254.249) (Ping timeout: 244 seconds) |
| 2021-06-15 09:06:23 | → | dunkeln joins (~dunkeln@94.129.65.28) |
| 2021-06-15 09:07:16 | <cheater> | how can I do this in Haskell? https://pastebin.com/Dyjf11Gu |
| 2021-06-15 09:07:45 | → | azeem joins (~azeem@176.200.200.250) |
| 2021-06-15 09:11:20 | → | ddellacosta joins (~ddellacos@89.45.224.34) |
| 2021-06-15 09:11:58 | → | n0db joins (~n0db@HSI-KBW-091-089-090-070.hsi2.kabelbw.de) |
| 2021-06-15 09:12:22 | <nitrix> | % do { xs <- ["a", "Bbb", "ccc", "EEE"]; ys <- ["bBb", "DDdD", "eeE"]; return (xs, ys, map toLower xs == map toLower ys) } |
| 2021-06-15 09:12:22 | <yahb> | nitrix: [("a","bBb",False),("a","DDdD",False),("a","eeE",False),("Bbb","bBb",True),("Bbb","DDdD",False),("Bbb","eeE",False),("ccc","bBb",False),("ccc","DDdD",False),("ccc","eeE",False),("EEE","bBb",False),("EEE","DDdD",False),("EEE","eeE",True)] |
| 2021-06-15 09:13:14 | <nitrix> | Lists are monads and they chain (>>=) by combining each of their elements together, exactly like your two nested loops. |
| 2021-06-15 09:13:47 | <nitrix> | You can use `do` notation, the `>>=` operator or even a list comprehension. All are pretty readable. |
| 2021-06-15 09:16:27 | × | ddellacosta quits (~ddellacos@89.45.224.34) (Ping timeout: 272 seconds) |
| 2021-06-15 09:17:13 | <cheater> | that's incorrect. you are matching the keys incorrectly. |
| 2021-06-15 09:17:19 | <cheater> | or rather the values. |
| 2021-06-15 09:17:26 | <cheater> | EEE should be compared with eeE. |
| 2021-06-15 09:17:37 | <cheater> | and Bbb with bBb. |
| 2021-06-15 09:18:08 | <cheater> | oh, i see what you're doing |
| 2021-06-15 09:18:30 | <cheater> | so how do I know to include "a" but also to include "bBb" and not "Bbb"? |
| 2021-06-15 09:22:05 | <nitrix> | It would need to return the first comparison that is successful instead of all the comparisons. You can return a list of a single String, like [String] and concatenate them all, or use Maybe String and use that monad instead (catMaybes, >>=, whatever). |
| 2021-06-15 09:22:14 | → | nsilv1 joins (~nsilv@host-82-50-119-12.retail.telecomitalia.it) |
| 2021-06-15 09:22:28 | <cheater> | i don't know how i would do that. it's a bit confusing. |
| 2021-06-15 09:22:35 | <cheater> | also... it all looks pretty inelegant |
| 2021-06-15 09:22:35 | × | nsilv quits (~nsilv@212.103.198.210) (Ping timeout: 272 seconds) |
| 2021-06-15 09:23:06 | × | dunkeln quits (~dunkeln@94.129.65.28) (Ping timeout: 264 seconds) |
| 2021-06-15 09:23:34 | <nitrix> | Or literally translate your code to haskell. For the map, do a map, for the for+if+return do a filter+headSafe. |
| 2021-06-15 09:24:02 | × | pe200012 quits (~pe200012@58.248.179.134) (Ping timeout: 244 seconds) |
| 2021-06-15 09:24:20 | → | pe200012 joins (~pe200012@183.63.73.36) |
| 2021-06-15 09:24:33 | <nitrix> | One sec. |
| 2021-06-15 09:24:57 | → | dunkeln joins (~dunkeln@94.129.65.28) |
| 2021-06-15 09:25:18 | → | ubert joins (~Thunderbi@2a02:8109:9880:303c:ca5b:76ff:fe29:f233) |
| 2021-06-15 09:25:26 | × | brian_da_mage quits (~Neuromanc@user/briandamag) (Ping timeout: 252 seconds) |
| 2021-06-15 09:27:45 | × | mikoto-chan quits (~mikoto-ch@ip-213-49-189-31.dsl.scarlet.be) (Quit: mikoto-chan) |
| 2021-06-15 09:28:42 | → | mikoto-chan joins (~mikoto-ch@ip-213-49-189-31.dsl.scarlet.be) |
| 2021-06-15 09:29:24 | × | yd502 quits (~yd502@180.168.212.6) (Ping timeout: 244 seconds) |
| 2021-06-15 09:30:02 | <nitrix> | % let xs = ["a", "Bbb", "ccc", "EEE"]; ys = ["bBb", "DDdD", "eeE"] in map (\e -> listToMaybe $ catMaybes $ map (\f -> if map toLower e == map toLower f then Just f else Nothing ) ys) xs |
| 2021-06-15 09:30:03 | <yahb> | nitrix: [Nothing,Just "bBb",Nothing,Just "eeE"] |
| 2021-06-15 09:30:16 | <nitrix> | It's pretty unreadable as a one-liner. |
| 2021-06-15 09:31:03 | <nitrix> | And you can probably use the nicer abstractions for manipulating the [String] and Maybe String. |
| 2021-06-15 09:32:10 | <nitrix> | I would be more useful if I had used Haskell more recently :P |
| 2021-06-15 09:33:25 | <cheater> | nitrix: also it doesn't include "a" or "ccc" |
| 2021-06-15 09:34:10 | <nitrix> | Oh you have return x at the end. |
| 2021-06-15 09:34:11 | → | kenran joins (~kenran@b2b-37-24-119-190.unitymedia.biz) |
| 2021-06-15 09:37:09 | <Rembane> | > let xs = ["a", "Bbb", "ccc", "EEE"]; ys = ["bBb", "DDdD", "eeE"] in [x | x <- xs, y <- ys, toLower x == toLower y] |
| 2021-06-15 09:37:11 | <lambdabot> | error: |
| 2021-06-15 09:37:11 | <lambdabot> | • Couldn't match expected type ‘Char’ with actual type ‘[Char]’ |
| 2021-06-15 09:37:11 | <lambdabot> | • In the first argument of ‘toLower’, namely ‘x’ |
| 2021-06-15 09:37:16 | × | fef quits (~thedawn@user/thedawn) (Ping timeout: 252 seconds) |
| 2021-06-15 09:38:48 | <Rembane> | > let xs = ["a", "Bbb", "ccc", "EEE"]; ys = ["bBb", "DDdD", "eeE"] in [x | x <- xs, y <- ys, map toLower x == map toLower y] |
| 2021-06-15 09:38:48 | <nitrix> | That'll be like the first version I posted. He wants the first element from the second list that matches the current element from the first list (the matching is case insensitive, but the result needs to be sensitive). |
| 2021-06-15 09:38:49 | <lambdabot> | ["Bbb","EEE"] |
| 2021-06-15 09:39:29 | <Rembane> | Oh |
| 2021-06-15 09:39:35 | <nitrix> | And, no matches is treated successfully too, it's a bit of an odd one. |
| 2021-06-15 09:39:41 | × | dunkeln quits (~dunkeln@94.129.65.28) (Ping timeout: 272 seconds) |
All times are in UTC.