Logs: freenode/#haskell
| 2021-03-20 20:51:24 | <tempate> | This is the latest version: https://paste.tomsmeding.com/EVARJua5 |
| 2021-03-20 20:51:33 | <tempate> | with all the comments you suggested above |
| 2021-03-20 20:52:12 | <ski> | (but i don't think there's anything wrong with `show (sum (map (fromEnum . policy1) passwords))', either. and the version with two `map's isn't too terrible, either, since `map' is incremental, and you're even likely to get fusion (so that the intermediate data structure is elided). however, it's good to be aware of such possibilities for refactoring) |
| 2021-03-20 20:52:36 | <tempate> | Fantastic |
| 2021-03-20 20:52:39 | <tempate> | I wasn't aware, tbh |
| 2021-03-20 20:53:55 | × | jamm_ quits (~jamm@unaffiliated/jamm) (Ping timeout: 276 seconds) |
| 2021-03-20 20:54:34 | <tempate> | I was thinking maybe matchIndex i = (str !! (i-1)) == char was potentially better |
| 2021-03-20 20:54:34 | → | elfets joins (~elfets@ip-37-201-23-96.hsi13.unitymediagroup.de) |
| 2021-03-20 20:54:39 | <ski> | tempate : ah, nice. yea, `(/=)' on `Bool' is exclusive disjunction |
| 2021-03-20 20:54:48 | <ski> | (and you noticed the missing argument) |
| 2021-03-20 20:55:02 | <tempate> | hehe, yeah |
| 2021-03-20 20:55:05 | <ski> | strIndex i = str !! (i-1) -- suffices |
| 2021-03-20 20:55:30 | <ski> | well, you could do that `matchIndex', if you prefer |
| 2021-03-20 20:56:03 | <tempate> | do you think it'd be better? |
| 2021-03-20 20:56:17 | <tempate> | there would be less repetition for once |
| 2021-03-20 20:56:34 | <ski> | ease of reasoning (equational reasoning, to a large part), refactoring, means that you can often apply them on a by-need basis, since they're, at least comparatively, low-effort |
| 2021-03-20 20:58:19 | <ski> | tempate : it might be slightly clearer in this case. but i don't think there's a huge difference. upto personal taste |
| 2021-03-20 20:58:30 | → | cyberlard joins (~cyberlard@unaffiliated/jludwig) |
| 2021-03-20 20:59:31 | <ski> | another problem is of course that if you reach for `!!' (or even `length'), then you probably shouldn't be using (linked) lists .. but let's ignore that |
| 2021-03-20 20:59:57 | × | frozenErebus quits (~frozenEre@94.129.70.18) (Ping timeout: 264 seconds) |
| 2021-03-20 21:00:03 | <tempate> | how would you do it? |
| 2021-03-20 21:00:43 | × | sord937 quits (~sord937@gateway/tor-sasl/sord937) (Quit: sord937) |
| 2021-03-20 21:00:45 | ski | still prefers avoiding redundant brackets in pattern (the `c:cs'), and usually would align them, across multiple defining equations |
| 2021-03-20 21:01:21 | × | Lord_of_Life quits (~Lord@unaffiliated/lord-of-life/x-0885362) (Ping timeout: 256 seconds) |
| 2021-03-20 21:01:36 | → | Vadrigar joins (~Vadrigar@ip5b417208.dynamic.kabel-deutschland.de) |
| 2021-03-20 21:02:11 | <tempate> | The compiler is bitching about the last two lines |
| 2021-03-20 21:02:22 | <tempate> | it doesn't like the whole `.` business |
| 2021-03-20 21:03:08 | <ski> | i guess i'd possibly use `Text', or maybe `ByteString'. but since they're presumably not that long, it probably doesn't matter that much, in this case |
| 2021-03-20 21:03:31 | <ski> | ah, because you omitted non-redundant brackets :) |
| 2021-03-20 21:04:24 | <ski> | (a) construct a chain/pipeline of functions; (b) apply that to an input |
| 2021-03-20 21:05:18 | <ski> | (using such composition chains is a bit related to "wholemeal programming", where one focuses on whole data structures at a time, rather than on individual parts of them, that one may be iterating through) |
| 2021-03-20 21:05:42 | <tempate> | so what are the needed parenthesis? |
| 2021-03-20 21:05:53 | × | Vadrigar quits (~Vadrigar@ip5b417208.dynamic.kabel-deutschland.de) (Ping timeout: 245 seconds) |
| 2021-03-20 21:05:57 | → | frozenErebus joins (~frozenEre@94.129.70.18) |
| 2021-03-20 21:08:14 | <ski> | <ski> (show . sum . map (fromEnum . policy1)) passwords |
| 2021-03-20 21:08:16 | × | _ht quits (~quassel@82-169-194-8.biz.kpn.net) (Remote host closed the connection) |
| 2021-03-20 21:09:35 | × | lawid quits (~quassel@dslb-090-186-099-083.090.186.pools.vodafone-ip.de) (Quit: lawid) |
| 2021-03-20 21:10:02 | <ski> | (some people would write `show . sum . map (fromEnum . policy1) $ passwords' instead. that's definitely to be preferred to `show $ sum $ map (fromEnum . policy1) $ passwords' or something like `show (sum $ map (fromEnum . policy1) $ passwords)'. with a chain with multiple `.'s, you can factor or (or fold back in) any subsequence of compositions of funtions, since `.' is associative. with `$', not so) |
| 2021-03-20 21:10:42 | × | frozenErebus quits (~frozenEre@94.129.70.18) (Ping timeout: 246 seconds) |
| 2021-03-20 21:11:18 | <tempate> | oh, the closing parenthesis comes before passwords because you're "merging" functions |
| 2021-03-20 21:11:20 | <tempate> | ok, got it |
| 2021-03-20 21:11:35 | → | lawid joins (~quassel@dslb-090-186-099-083.090.186.pools.vodafone-ip.de) |
| 2021-03-20 21:12:41 | <tempate> | Thanks again for all the help, ski |
| 2021-03-20 21:12:49 | <ski> | no problem :) |
| 2021-03-20 21:13:39 | → | acidjnk_new joins (~acidjnk@p200300d0c72b959874ac6c8157d63e67.dip0.t-ipconnect.de) |
| 2021-03-20 21:13:49 | × | raehik quits (~raehik@cpc95906-rdng25-2-0-cust156.15-3.cable.virginm.net) (Ping timeout: 256 seconds) |
| 2021-03-20 21:17:31 | → | frozenErebus joins (~frozenEre@94.129.70.18) |
| 2021-03-20 21:22:08 | × | LogicUpgrade quits (57e3c46d@87.227.196.109) (Quit: Connection closed) |
| 2021-03-20 21:25:34 | × | zebrag quits (~inkbottle@aaubervilliers-654-1-109-157.w86-212.abo.wanadoo.fr) (Quit: Konversation terminated!) |
| 2021-03-20 21:25:53 | → | zebrag joins (~inkbottle@aaubervilliers-654-1-109-157.w86-212.abo.wanadoo.fr) |
| 2021-03-20 21:26:11 | × | __monty__ quits (~toonn@unaffiliated/toonn) (Quit: leaving) |
| 2021-03-20 21:27:26 | → | Guest53001 joins (~soulseeke@90.214.167.201) |
| 2021-03-20 21:29:32 | × | teardown quits (~user@gateway/tor-sasl/mrush) (Remote host closed the connection) |
| 2021-03-20 21:29:59 | → | teardown joins (~user@gateway/tor-sasl/mrush) |
| 2021-03-20 21:32:15 | × | Mrbuck quits (~Mrbuck@gateway/tor-sasl/mrbuck) (Quit: WeeChat 2.8) |
| 2021-03-20 21:32:16 | × | Tario quits (~Tario@201.192.165.173) (Read error: Connection reset by peer) |
| 2021-03-20 21:32:26 | → | Tario joins (~Tario@201.192.165.173) |
| 2021-03-20 21:33:22 | × | sz0 quits (uid110435@gateway/web/irccloud.com/x-tywxgqqycltuflco) (Quit: Connection closed for inactivity) |
| 2021-03-20 21:33:48 | × | knupfer quits (~Thunderbi@i5E86B4F3.versanet.de) (Ping timeout: 246 seconds) |
| 2021-03-20 21:38:38 | → | LogicUpgrade joins (57e3c46d@87.227.196.109) |
| 2021-03-20 21:39:17 | × | caubert_ quits (~caubert@136.244.111.235) (Quit: WeeChat 3.0) |
| 2021-03-20 21:39:29 | → | ph88 joins (~ph88@2a02:8109:9e00:7e5c:d4b6:e9e6:3cda:8e26) |
| 2021-03-20 21:39:32 | → | caubert joins (~caubert@136.244.111.235) |
| 2021-03-20 21:39:33 | → | elliott__ joins (~elliott@pool-108-51-101-42.washdc.fios.verizon.net) |
| 2021-03-20 21:44:15 | → | day_ joins (~Unknown@unaffiliated/day) |
| 2021-03-20 21:44:37 | → | cyphase joins (~cyphase@unaffiliated/cyphase) |
| 2021-03-20 21:45:00 | × | LogicUpgrade quits (57e3c46d@87.227.196.109) (Quit: Connection closed) |
| 2021-03-20 21:45:41 | × | ph88 quits (~ph88@2a02:8109:9e00:7e5c:d4b6:e9e6:3cda:8e26) (Ping timeout: 265 seconds) |
| 2021-03-20 21:46:09 | × | wroathe quits (~wroathe@c-68-54-25-135.hsd1.mn.comcast.net) (Ping timeout: 264 seconds) |
| 2021-03-20 21:46:16 | → | codygman` joins (~user@47.186.207.161) |
| 2021-03-20 21:47:46 | → | merijn joins (~merijn@83-160-49-249.ip.xs4all.nl) |
| 2021-03-20 21:47:52 | × | day quits (~Unknown@unaffiliated/day) (Ping timeout: 256 seconds) |
| 2021-03-20 21:47:53 | day_ | is now known as day |
| 2021-03-20 21:49:01 | → | coot joins (~coot@37.30.58.223.nat.umts.dynamic.t-mobile.pl) |
| 2021-03-20 21:49:02 | → | benkolera joins (uid285671@gateway/web/irccloud.com/x-ewecqecbsbwhnnil) |
| 2021-03-20 21:50:00 | <koz_> | > [2, 4 .. 8] |
| 2021-03-20 21:50:02 | <lambdabot> | [2,4,6,8] |
| 2021-03-20 21:50:05 | <koz_> | :D |
| 2021-03-20 21:50:12 | × | m1dnight1 quits (~m1dnight@188.ip-51-91-158.eu) (Quit: WeeChat 2.4) |
| 2021-03-20 21:50:30 | × | kenran quits (~kenran@i59F67B31.versanet.de) (Quit: leaving) |
| 2021-03-20 21:51:11 | → | molehillish joins (~molehilli@2600:8800:8d06:1800:c1f2:e355:53f0:4ab8) |
| 2021-03-20 21:51:19 | × | Guest98765 quits (~textual@2603-7000-3040-0000-a433-b15d-87dc-0aaa.res6.spectrum.com) (Quit: My MacBook has gone to sleep. ZZZzzz…) |
| 2021-03-20 21:51:24 | × | teardown quits (~user@gateway/tor-sasl/mrush) (Remote host closed the connection) |
| 2021-03-20 21:51:46 | → | teardown joins (~user@gateway/tor-sasl/mrush) |
| 2021-03-20 21:52:23 | → | Alleria joins (~textual@2603-7000-3040-0000-a433-b15d-87dc-0aaa.res6.spectrum.com) |
| 2021-03-20 21:52:47 | Alleria | is now known as Guest65957 |
| 2021-03-20 21:53:29 | → | ezrakilty joins (~ezrakilty@97-113-58-224.tukw.qwest.net) |
| 2021-03-20 21:53:44 | × | Sathiana quits (~kath@185-113-98-38.cust.bredband2.com) (Ping timeout: 240 seconds) |
| 2021-03-20 21:55:45 | × | alx741 quits (~alx741@181.196.68.246) (Ping timeout: 264 seconds) |
| 2021-03-20 21:56:18 | × | molehillish quits (~molehilli@2600:8800:8d06:1800:c1f2:e355:53f0:4ab8) (Remote host closed the connection) |
| 2021-03-20 21:56:51 | → | wroathe joins (~wroathe@c-68-54-25-135.hsd1.mn.comcast.net) |
| 2021-03-20 21:58:03 | → | molehillish joins (~molehilli@2600:8800:8d06:1800:c1f2:e355:53f0:4ab8) |
| 2021-03-20 22:01:48 | × | wroathe quits (~wroathe@c-68-54-25-135.hsd1.mn.comcast.net) (Ping timeout: 246 seconds) |
| 2021-03-20 22:03:37 | → | Lycurgus joins (~niemand@98.4.116.165) |
| 2021-03-20 22:04:23 | → | Rudd0 joins (~Rudd0@185.189.115.108) |
| 2021-03-20 22:06:01 | → | myShoggoth joins (~myShoggot@75.164.81.55) |
| 2021-03-20 22:08:09 | → | alx741 joins (~alx741@181.196.69.79) |
| 2021-03-20 22:12:13 | × | molehillish quits (~molehilli@2600:8800:8d06:1800:c1f2:e355:53f0:4ab8) (Remote host closed the connection) |
| 2021-03-20 22:12:13 | × | LKoen quits (~LKoen@194.250.88.92.rev.sfr.net) (Quit: “It’s only logical. First you learn to talk, then you learn to think. Too bad it’s not the other way round.”) |
| 2021-03-20 22:15:01 | → | molehillish joins (~molehilli@2600:8800:8d06:1800:c1f2:e355:53f0:4ab8) |
All times are in UTC.