Logs: freenode/#haskell
| 2020-10-22 23:36:56 | × | son0p quits (~son0p@181.136.122.143) (Quit: leaving) |
| 2020-10-22 23:37:33 | × | invaser quits (~Thunderbi@31.148.23.125) (Ping timeout: 260 seconds) |
| 2020-10-22 23:40:05 | → | acertain_ joins (uid470584@gateway/web/irccloud.com/x-nuijhjibtvepkxua) |
| 2020-10-22 23:40:05 | × | wroathe quits (~wroathe@c-68-54-25-135.hsd1.mn.comcast.net) (Ping timeout: 240 seconds) |
| 2020-10-22 23:42:05 | × | erolm_a quits (~erolm_a@62.18.212.252) (Ping timeout: 256 seconds) |
| 2020-10-22 23:42:23 | → | erolm_a joins (~erolm_a@62.18.212.252) |
| 2020-10-22 23:43:29 | × | acertain quits (~acertain@unaffiliated/fread2281) (Disconnected by services) |
| 2020-10-22 23:43:30 | acertain_ | is now known as acertain |
| 2020-10-22 23:43:43 | → | acertain- joins (~acertain@unaffiliated/fread2281) |
| 2020-10-22 23:46:45 | × | acertain- quits (~acertain@unaffiliated/fread2281) (Client Quit) |
| 2020-10-22 23:47:28 | → | conal joins (~conal@66.115.157.144) |
| 2020-10-22 23:47:35 | × | brisbin quits (~patrick@pool-173-49-158-4.phlapa.fios.verizon.net) (Ping timeout: 260 seconds) |
| 2020-10-22 23:48:45 | × | conal quits (~conal@66.115.157.144) (Client Quit) |
| 2020-10-22 23:49:25 | × | erolm_a quits (~erolm_a@62.18.212.252) (Ping timeout: 264 seconds) |
| 2020-10-22 23:49:25 | × | stefan-__ quits (~cri@42dots.de) (Read error: Connection reset by peer) |
| 2020-10-22 23:49:41 | → | stefan-__ joins (~cri@42dots.de) |
| 2020-10-22 23:50:36 | → | erolm_a joins (~erolm_a@62.18.212.252) |
| 2020-10-22 23:52:08 | × | geowiesnot quits (~user@87-89-181-157.abo.bbox.fr) (Ping timeout: 256 seconds) |
| 2020-10-22 23:52:55 | → | tromp joins (~tromp@dhcp-077-249-230-040.chello.nl) |
| 2020-10-22 23:55:00 | × | dhil quits (~dhil@195.213.192.122) (Ping timeout: 258 seconds) |
| 2020-10-22 23:55:02 | × | irc_user quits (uid423822@gateway/web/irccloud.com/x-ytqlliqaiojyqsrz) (Quit: Connection closed for inactivity) |
| 2020-10-22 23:57:27 | × | N3RGY quits (~N3RGY@65.141.87.122) (Remote host closed the connection) |
| 2020-10-22 23:57:59 | → | christo joins (~chris@81.96.113.213) |
| 2020-10-22 23:58:02 | → | N3RGY joins (~N3RGY@65.141.87.122) |
| 2020-10-22 23:58:54 | → | merijn joins (~merijn@83-160-49-249.ip.xs4all.nl) |
| 2020-10-22 23:59:13 | × | texasmynsted quits (~texasmyns@104.140.52.115) () |
| 2020-10-22 23:59:32 | → | texasmynsted joins (~texasmyns@104.140.52.115) |
| 2020-10-22 23:59:42 | × | Tuplanolla quits (~Tuplanoll@91-159-68-239.elisa-laajakaista.fi) (Quit: Leaving.) |
| 2020-10-23 00:00:01 | × | valli1 quits (~valli@139.28.218.148) () |
| 2020-10-23 00:01:05 | × | tromp quits (~tromp@dhcp-077-249-230-040.chello.nl) (Ping timeout: 240 seconds) |
| 2020-10-23 00:01:28 | <ski> | Guest18 : use `replicateM_'. also remove the `return ()'s |
| 2020-10-23 00:02:10 | <Guest18> | Yeah, I know the returns are redundant |
| 2020-10-23 00:02:11 | <ski> | Guest18 : `percentage' has redundant brackets. (also `(Num a) =>' could be `Num a =>') |
| 2020-10-23 00:02:23 | <Guest18> | why replicateM_? |
| 2020-10-23 00:02:37 | <ski> | because you don't care about the list of results, anyway |
| 2020-10-23 00:02:52 | × | N3RGY quits (~N3RGY@65.141.87.122) (Ping timeout: 265 seconds) |
| 2020-10-23 00:03:11 | <ski> | `replicateM n act' is when you want to get back a list of `n' results of executing `act' |
| 2020-10-23 00:03:38 | <ski> | if you just want to do something `n' times, but don't care about collecting results in a list, it's better to use `replicateM_' |
| 2020-10-23 00:04:11 | × | merijn quits (~merijn@83-160-49-249.ip.xs4all.nl) (Ping timeout: 256 seconds) |
| 2020-10-23 00:04:20 | <Guest18> | doesn't the compiler optimize this stuff anyway? Or is it the more idiomatic way of doing things? |
| 2020-10-23 00:04:23 | × | steve__ quits (~quassel@ool-18b99d28.dyn.optonline.net) (Ping timeout: 260 seconds) |
| 2020-10-23 00:04:48 | × | steve_ quits (~quassel@ool-18b99d28.dyn.optonline.net) (Ping timeout: 265 seconds) |
| 2020-10-23 00:04:48 | <ski> | also, you could use `n <- readIO input_line :: IO Int'. in case of a parsing error, this will abort immediately, rather than when `n' is later used |
| 2020-10-23 00:04:55 | → | YellowOnion joins (~YellowOni@125-237-198-213-fibre.sparkbb.co.nz) |
| 2020-10-23 00:05:22 | <ski> | also, you could replace that, and `input_line <- getLine', by `n <- readLn :: IO Int', which does both for you |
| 2020-10-23 00:05:47 | × | ph88 quits (~ph88@ip5f5af0cc.dynamic.kabel-deutschland.de) (Ping timeout: 260 seconds) |
| 2020-10-23 00:05:49 | <ski> | Guest18 : it probably doesn't optimize it away, i think |
| 2020-10-23 00:06:07 | <Guest18> | num key sub = foldr (\(x,y) b -> if x == y then b+1 else b) 0 $ zip key sub -- what about this? |
| 2020-10-23 00:07:19 | × | efertone quits (~efertone@138.68.79.27) (Read error: Connection reset by peer) |
| 2020-10-23 00:07:31 | <ski> | (you could use `n :: Int <- readIO input_line' or `n :: Int <- readLn' instead, if you enable extension `ScopedTypeVariables'. this looks slightly more pretty. or you could just leave out the ascription, and let it infer that `n' is an `Int' (since it's passed to `replicateM_')) |
| 2020-10-23 00:07:37 | <ski> | @type replicateM_ |
| 2020-10-23 00:07:39 | <lambdabot> | Applicative m => Int -> m a -> m () |
| 2020-10-23 00:07:40 | <ski> | @type replicateM |
| 2020-10-23 00:07:41 | <lambdabot> | Applicative m => Int -> m a -> m [a] |
| 2020-10-23 00:08:10 | → | efertone joins (~efertone@138.68.79.27) |
| 2020-10-23 00:08:29 | <ski> | yea, next thing i was going to comment on was that your `num' in the paste only works if the two lists (`String's ..) have the same length |
| 2020-10-23 00:08:47 | <Guest18> | it's guaranteed that they are |
| 2020-10-23 00:09:01 | <ski> | ok |
| 2020-10-23 00:09:23 | <ski> | well, there's many different ways to do it |
| 2020-10-23 00:09:41 | <Guest18> | how would you do it? |
| 2020-10-23 00:10:11 | <ski> | you could e.g. filter the `zip key sub' list, keeping only the pairs in which the two components are equal to each other. then count how many pairs you have left |
| 2020-10-23 00:10:25 | <ski> | you could use a list comprehension, if you want to |
| 2020-10-23 00:11:06 | <ski> | if you're going to use a fold, then probably foldl' is better, here, btw |
| 2020-10-23 00:11:23 | <simon> | 单子 is monad in chinese. |
| 2020-10-23 00:11:50 | <ski> | in Leibniz' sense, too ? |
| 2020-10-23 00:12:17 | <simon> | I think so. the dictionary says "(functional programming or philosophy) monad" -- I don't know if that encompasses math. |
| 2020-10-23 00:12:29 | → | elliott__ joins (~elliott@pool-108-51-141-12.washdc.fios.verizon.net) |
| 2020-10-23 00:12:39 | <ski> | (personally i'd also not use `$' in there) |
| 2020-10-23 00:12:40 | <simon> | I think only chinese mathematicians know. :) |
| 2020-10-23 00:12:57 | <Guest18> | num key sub = length [(x,y) | (x,y) <- zip(key, sub), x == y] -- don't know if i wrote it correctly, but something like this maybe?> |
| 2020-10-23 00:13:02 | <ski> | presumably it does, simon |
| 2020-10-23 00:13:32 | <ski> | Guest18 : looks ok. although, instead of collecting `(x,y)' you could collect, say, `()' |
| 2020-10-23 00:13:35 | <simon> | I wonder if right-associative function application in chinese is 'f ¥ x' |
| 2020-10-23 00:13:46 | <Guest18> | ski: that makes sense |
| 2020-10-23 00:13:51 | <ski> | (or you could collect `1's, and then `sum' .. many ways to "skin the cat") |
| 2020-10-23 00:14:25 | <ski> | not in japanese, then ? |
| 2020-10-23 00:14:50 | <simon> | surely :-D |
| 2020-10-23 00:14:58 | <ski> | btw, it's `zip key sub', not `zip(key, sub)' |
| 2020-10-23 00:15:18 | <ski> | also, you could use `zipWith (==) key sub', to get a list of `Bool'eans, directly |
| 2020-10-23 00:18:21 | → | AceNovo joins (~chris@184.101.197.134) |
| 2020-10-23 00:18:35 | <ski> | > [x + y | x <- [0,1,2,3] | y <- [40,50,60]] -- another extension |
| 2020-10-23 00:18:37 | <lambdabot> | [40,51,62] |
| 2020-10-23 00:22:10 | <koz_> | @hoogle asum |
| 2020-10-23 00:22:10 | <lambdabot> | Data.Foldable asum :: (Foldable t, Alternative f) => t (f a) -> f a |
| 2020-10-23 00:22:10 | <lambdabot> | Data.Conduit.Combinators asum :: (Monad m, Alternative f) => ConduitT (f a) o m (f a) |
| 2020-10-23 00:22:10 | <lambdabot> | Protolude asum :: (Foldable t, Alternative f) => t (f a) -> f a |
| 2020-10-23 00:23:11 | × | AceNovo quits (~chris@184.101.197.134) (Client Quit) |
| 2020-10-23 00:23:34 | → | AceNovo joins (~chris@184.101.197.134) |
| 2020-10-23 00:24:22 | × | erolm_a quits (~erolm_a@62.18.212.252) (Ping timeout: 256 seconds) |
| 2020-10-23 00:24:22 | × | stefan-__ quits (~cri@42dots.de) (Read error: Connection reset by peer) |
| 2020-10-23 00:24:41 | → | stefan-__ joins (~cri@42dots.de) |
| 2020-10-23 00:25:33 | × | alp quits (~alp@2a01:e0a:58b:4920:d80c:9dfe:7aa1:7540) (Ping timeout: 272 seconds) |
| 2020-10-23 00:25:36 | → | erolm_a joins (~erolm_a@62.18.212.252) |
| 2020-10-23 00:30:24 | → | ensyde joins (~ensyde@2600:1702:2e30:1a40:693a:f19:42e4:5751) |
| 2020-10-23 00:32:39 | → | merijn joins (~merijn@83-160-49-249.ip.xs4all.nl) |
| 2020-10-23 00:35:29 | × | reppertj quits (~textual@pool-96-246-209-59.nycmny.fios.verizon.net) (Quit: Textual IRC Client: www.textualapp.com) |
| 2020-10-23 00:36:19 | → | nbloomf joins (~nbloomf@2600:1700:ad14:3020:ccf3:9e4f:a615:179a) |
| 2020-10-23 00:36:28 | × | karanlikmadde quits (~karanlikm@2a01:c23:644a:cd00:7c72:1147:1d73:30c9) (Quit: karanlikmadde) |
| 2020-10-23 00:38:44 | × | heatsink quits (~heatsink@107-136-5-69.lightspeed.sntcca.sbcglobal.net) (Remote host closed the connection) |
| 2020-10-23 00:38:48 | × | StoneToad_ quits (~StoneToad@199-167-119-164.ppp.storm.ca) (Ping timeout: 260 seconds) |
All times are in UTC.