2024/09/08

Newest at the top

2024-09-08 02:42:41 +0200merijn(~merijn@204-220-045-062.dynamic.caiway.nl)
2024-09-08 02:40:49 +0200 <geekosaur> if you got a lot of "x for i in …" then you got Python's list comprehensions, which aren't quite as elaborate as Haskell's but do roughly the same thing
2024-09-08 02:37:29 +0200 <geekosaur> "Haskell list comprehension" (if you don't specify the language, you probably get Python's)
2024-09-08 02:37:25 +0200 <lambdaRule> reading, from QuickCheck
2024-09-08 02:37:15 +0200 <lambdaRule> this is some very old code that I
2024-09-08 02:36:43 +0200 <lambdaRule> thanks for all the info. I searched list comprehension syntax but I haven't found anything. What should I have searched?
2024-09-08 02:36:25 +0200 <geekosaur> for that matter, it doesn't even avoid an import since they have to use sequence instead
2024-09-08 02:35:06 +0200 <geekosaur> (or sequence, as in your given code)
2024-09-08 02:34:05 +0200 <geekosaur> also note that these examples are a little too oversimplified, since replicate is sufficient for them. but arbitrary requires replicateM, I think
2024-09-08 02:32:37 +0200 <geekosaur> I guess the only reason to use the list comp is to avoid the import. it doesn't even avoid a dependency, since Control.Monad is in base
2024-09-08 02:32:07 +0200 <lambdabot> replicateM n x = sequence (replicate n x)
2024-09-08 02:32:07 +0200 <dmj`> @src replicateM
2024-09-08 02:31:39 +0200 <lambdabot> Control.Monad, Data.Sequence
2024-09-08 02:31:39 +0200 <geekosaur> @index replicateM
2024-09-08 02:31:33 +0200merijn(~merijn@204-220-045-062.dynamic.caiway.nl) (Ping timeout: 246 seconds)
2024-09-08 02:30:51 +0200CiaoSen(~Jura@2a05:5800:459:6700:ca4b:d6ff:fec1:99da) (Ping timeout: 246 seconds)
2024-09-08 02:30:49 +0200 <lambdabot> [(),(),(),(),(),(),(),(),(),()]
2024-09-08 02:30:47 +0200 <geekosaur> > [() | _ <- [1..10]]
2024-09-08 02:30:22 +0200 <geekosaur> yeh, I'd've used replicateM instead of the list comprehension
2024-09-08 02:29:18 +0200 <lambdabot> [(),(),(),(),(),(),(),(),(),()]
2024-09-08 02:29:16 +0200 <monochrom> > [() | i <- [1..10]]
2024-09-08 02:29:07 +0200 <monochrom> Yeah, i is "unused", but [1..n] causes the list to have length n.
2024-09-08 02:28:16 +0200 <dmj`> vector n = replicateM n arbitrary
2024-09-08 02:28:01 +0200sayola(~sayola@2a00:20:d307:80d8:cc05:636b:e7c8:3824)
2024-09-08 02:27:35 +0200Tuplanolla(~Tuplanoll@91-159-69-59.elisa-laajakaista.fi) (Quit: Leaving.)
2024-09-08 02:26:53 +0200merijn(~merijn@204-220-045-062.dynamic.caiway.nl)
2024-09-08 02:26:44 +0200justsomeguy(~justsomeg@user/justsomeguy)
2024-09-08 02:24:29 +0200 <lambdaRule> what's the purpose of i?
2024-09-08 02:24:15 +0200 <lambdaRule> vector n = sequence [ arbitrary | i <- [1..n] ]
2024-09-08 02:24:15 +0200 <lambdaRule> vector :: Arbitrary a => Int -> Gen [a]
2024-09-08 02:24:14 +0200 <lambdaRule> arbitrary :: Arbitrary a => Gen a
2024-09-08 02:24:14 +0200 <lambdaRule> how to understand this list comprehension?
2024-09-08 02:22:18 +0200lambdaRule(~lambdaRul@node-1w7jr9phpv011s6crr0owcb3v.ipv6.telus.net)
2024-09-08 02:21:53 +0200euleritian(~euleritia@ip4d16fc38.dynamic.kabel-deutschland.de)
2024-09-08 02:21:01 +0200euleritian(~euleritia@ip4d16fc38.dynamic.kabel-deutschland.de) (Remote host closed the connection)
2024-09-08 02:15:48 +0200merijn(~merijn@204-220-045-062.dynamic.caiway.nl) (Ping timeout: 245 seconds)
2024-09-08 02:11:06 +0200merijn(~merijn@204-220-045-062.dynamic.caiway.nl)
2024-09-08 02:05:52 +0200acidjnk_new(~acidjnk@p200300d6e72cfb079527f265a4c52d61.dip0.t-ipconnect.de) (Ping timeout: 272 seconds)
2024-09-08 02:03:34 +0200mhatta(~mhatta@www21123ui.sakura.ne.jp)
2024-09-08 02:02:06 +0200alexherbo2(~alexherbo@2a02-8440-3114-792e-ddff-112f-809e-f52d.rev.sfr.net) (Remote host closed the connection)
2024-09-08 02:00:16 +0200mhatta(~mhatta@www21123ui.sakura.ne.jp) (Remote host closed the connection)
2024-09-08 02:00:03 +0200merijn(~merijn@204-220-045-062.dynamic.caiway.nl) (Ping timeout: 246 seconds)
2024-09-08 01:55:19 +0200merijn(~merijn@204-220-045-062.dynamic.caiway.nl)
2024-09-08 01:47:47 +0200weary-traveler(~user@user/user363627) (Remote host closed the connection)
2024-09-08 01:44:17 +0200merijn(~merijn@204-220-045-062.dynamic.caiway.nl) (Ping timeout: 244 seconds)
2024-09-08 01:39:32 +0200merijn(~merijn@204-220-045-062.dynamic.caiway.nl)
2024-09-08 01:36:07 +0200xal(~xal@mx1.xal.systems)
2024-09-08 01:35:28 +0200xal(~xal@mx1.xal.systems) (Quit: bye)
2024-09-08 01:29:03 +0200Inst(~Inst@user/Inst)
2024-09-08 01:28:43 +0200Inst(~Inst@user/Inst) (Remote host closed the connection)