Logs: freenode/#haskell
| 2020-10-03 19:12:53 | → | knupfer joins (~Thunderbi@i59F7FF93.versanet.de) |
| 2020-10-03 19:12:53 | × | machinedgod quits (~machinedg@45.78.189.122) (Read error: Connection reset by peer) |
| 2020-10-03 19:13:24 | → | fluturel joins (~fluturel@79.119.85.203) |
| 2020-10-03 19:14:23 | → | ixlun joins (~matthew@213.205.241.94) |
| 2020-10-03 19:14:25 | × | xff0x quits (~fox@141.98.255.143) (Ping timeout: 240 seconds) |
| 2020-10-03 19:14:29 | × | fluturel quits (~fluturel@79.119.85.203) (Read error: Connection reset by peer) |
| 2020-10-03 19:15:49 | <ixlun> | Hi all, I'm trying to do a fold with a cutoff.. i.e. at some point during the computation of the fold, an intermediate value should be retunrned, even though the entire input list may not have been traversed. |
| 2020-10-03 19:16:09 | → | heatsink joins (~heatsink@107-136-5-69.lightspeed.sntcca.sbcglobal.net) |
| 2020-10-03 19:16:15 | <ixlun> | I'm currently trying: `head . takeWhile cutoff . scanr' |
| 2020-10-03 19:16:21 | → | xff0x joins (~fox@2001:1a81:528f:c400:e801:3cdf:9d3a:43d8) |
| 2020-10-03 19:16:25 | × | elliott_ quits (~elliott_@141.156.194.190) (Ping timeout: 240 seconds) |
| 2020-10-03 19:16:32 | → | manwolf joins (~manwolf12@106.192.162.147) |
| 2020-10-03 19:16:35 | × | elliott__ quits (~elliott@141.156.194.190) (Ping timeout: 240 seconds) |
| 2020-10-03 19:16:53 | <dsal> | :t scanr |
| 2020-10-03 19:16:55 | <lambdabot> | (a -> b -> b) -> b -> [a] -> [b] |
| 2020-10-03 19:17:17 | <ixlun> | I'm not sure if that's doing as I expect... if I traceShowId on the value returned by cutoff, it appears to only be evaluated once |
| 2020-10-03 19:17:58 | <dsal> | I'm a bit confused as to what you're doing. Can you just use foldr? |
| 2020-10-03 19:18:23 | <ixlun> | I can kind of see why it's doing that since I'm calliing `head', but that's only to get the value where the the cutoff predicate became true. |
| 2020-10-03 19:18:48 | → | machinedgod joins (~machinedg@45.78.189.122) |
| 2020-10-03 19:18:57 | <geekosaur> | it's lazy so the scan would end when you stop consuming values |
| 2020-10-03 19:18:59 | <dsal> | If you move that predicate into the argument to foldr, I would expect it to do the right thing. |
| 2020-10-03 19:21:05 | <dsal> | Does that function differently from `f i . head` ? |
| 2020-10-03 19:21:10 | dsal | needs to have lunch |
| 2020-10-03 19:21:14 | <ixlun> | Say I have the list: [a,b,c,d] and I also have a predicate function `cutoff :: x -> Bool'. Part way through the list that preciate could become true, so I want to stop the fold at that point and return the value |
| 2020-10-03 19:21:51 | <dsal> | Is the predicate on the input or the output? If it's the output, then it doesn't seem to do anything at all. |
| 2020-10-03 19:22:13 | <ixlun> | The predicate is on the output |
| 2020-10-03 19:22:53 | <dsal> | But if you're asking for head, so it's a partial function that either returns the first output, or there's no output. |
| 2020-10-03 19:23:48 | → | macrover joins (~macrover@ip70-189-231-35.lv.lv.cox.net) |
| 2020-10-03 19:23:59 | <ixlun> | Yeah, that's not what I want I guess |
| 2020-10-03 19:25:37 | <ixlun> | As an example, suppose I predicate: `x > 10' and then I have: `foldl (+) 0 [2,3,4,5]' I'd want the return value to be: 9 |
| 2020-10-03 19:26:00 | <ixlun> | is there such a thing? |
| 2020-10-03 19:27:06 | → | thir joins (~thir@p200300f27f0fc60004d129737887aa72.dip0.t-ipconnect.de) |
| 2020-10-03 19:28:12 | <ahf> | jag |
| 2020-10-03 19:29:51 | <ixlun> | I suppose what I'm after is a terminating fold |
| 2020-10-03 19:30:04 | <dsal> | Well, foldr terminates. |
| 2020-10-03 19:30:16 | <dsal> | But it's a bit hard in this exact situation. |
| 2020-10-03 19:31:09 | → | Sgeo joins (~Sgeo@ool-18b982ad.dyn.optonline.net) |
| 2020-10-03 19:31:48 | <dsal> | foldr will stop if you don't look at the output, but your condition depends on that here. |
| 2020-10-03 19:32:08 | → | kernelmethod joins (~kernelmet@c-73-181-114-129.hsd1.co.comcast.net) |
| 2020-10-03 19:32:25 | × | thir quits (~thir@p200300f27f0fc60004d129737887aa72.dip0.t-ipconnect.de) (Ping timeout: 240 seconds) |
| 2020-10-03 19:34:02 | <dsal> | > last . takeWhile (<10) . scanl (+) 0 $ [2..] -- this is pretty close to what you described. |
| 2020-10-03 19:34:05 | <lambdabot> | 9 |
| 2020-10-03 19:35:27 | <Zetagon> | wait I'm new here, but does lambdabot evaluate all haskell code? or just pure? |
| 2020-10-03 19:35:52 | <Rembane> | > putStrLn "Maybe?" |
| 2020-10-03 19:35:53 | <dsal> | It's sandboxed. yahb is less restricted. |
| 2020-10-03 19:35:55 | <lambdabot> | <IO ()> |
| 2020-10-03 19:36:02 | <dsal> | % putStrLn "hi" |
| 2020-10-03 19:36:02 | <yahb> | dsal: hi |
| 2020-10-03 19:36:05 | → | renzhi joins (~renzhi@modemcable070.17-177-173.mc.videotron.ca) |
| 2020-10-03 19:36:29 | <ixlun> | dsal: Ahhh I get it, last and scanl will cause the evaluation to happen |
| 2020-10-03 19:36:51 | <dsal> | That's kind of a weird way to think about it. |
| 2020-10-03 19:37:18 | <dsal> | You're not worried about "causing evaluation" because there's no difference between something that didn't happen and something that wasn't observed. |
| 2020-10-03 19:37:45 | <dsal> | last is just the thing you were asking for -- it's the boundary value in the produced list, as opposed to head, which is always the same. |
| 2020-10-03 19:38:16 | → | ciupakabra5 joins (836f05b6@global-5-182.nat-2.net.cam.ac.uk) |
| 2020-10-03 19:38:23 | <ciupakabra5> | mm |
| 2020-10-03 19:38:58 | <ciupakabra5> | darn this is weird, so I've connected to Freenode through their website, and it lets me write in #haskell but not in #xmonad |
| 2020-10-03 19:39:10 | <Xnuk> | % readFile "." |
| 2020-10-03 19:39:11 | <yahb> | Xnuk: *** Exception: .: openFile: inappropriate type (is a directory) |
| 2020-10-03 19:40:16 | → | vicfred joins (~vicfred@unaffiliated/vicfred) |
| 2020-10-03 19:40:20 | <Xnuk> | % readFile "/etc/hostname" |
| 2020-10-03 19:40:20 | <yahb> | Xnuk: *** Exception: /etc/hostname: openFile: does not exist (No such file or directory) |
| 2020-10-03 19:40:49 | × | knupfer quits (~Thunderbi@i59F7FF93.versanet.de) (Quit: knupfer) |
| 2020-10-03 19:41:26 | → | knupfer joins (~Thunderbi@200116b82c95f60035804b3f286051fa.dip.versatel-1u1.de) |
| 2020-10-03 19:43:16 | × | macrover quits (~macrover@ip70-189-231-35.lv.lv.cox.net) (Ping timeout: 265 seconds) |
| 2020-10-03 19:43:55 | × | supercoven quits (~Supercove@dsl-hkibng32-54fb54-166.dhcp.inet.fi) (Ping timeout: 240 seconds) |
| 2020-10-03 19:44:13 | × | ciupakabra quits (~andrius@global-5-182.nat-2.net.cam.ac.uk) (Quit: leaving) |
| 2020-10-03 19:44:39 | → | chaosmasttter joins (~chaosmast@p200300c4a711ea01f472f055cac452c2.dip0.t-ipconnect.de) |
| 2020-10-03 19:45:41 | × | kernelmethod quits (~kernelmet@c-73-181-114-129.hsd1.co.comcast.net) (Ping timeout: 265 seconds) |
| 2020-10-03 19:49:04 | → | kernelmethod joins (~kernelmet@c-73-181-114-129.hsd1.co.comcast.net) |
| 2020-10-03 19:49:57 | × | ciupakabra5 quits (836f05b6@global-5-182.nat-2.net.cam.ac.uk) (Remote host closed the connection) |
| 2020-10-03 19:50:42 | × | kernelmethod quits (~kernelmet@c-73-181-114-129.hsd1.co.comcast.net) (Client Quit) |
| 2020-10-03 19:56:52 | → | jle` joins (~mstksg@cpe-23-240-75-236.socal.res.rr.com) |
| 2020-10-03 19:56:52 | × | jle` quits (~mstksg@cpe-23-240-75-236.socal.res.rr.com) (Changing host) |
| 2020-10-03 19:56:52 | → | jle` joins (~mstksg@unaffiliated/mstksg) |
| 2020-10-03 19:59:30 | × | geekosaur quits (42d52102@66.213.33.2) (Remote host closed the connection) |
| 2020-10-03 20:00:25 | → | sand_dull joins (~theuser@cpe-67-252-1-237.nycap.res.rr.com) |
| 2020-10-03 20:00:50 | → | carlomagno1 joins (~cararell@inet-hqmc02-o.oracle.com) |
| 2020-10-03 20:02:35 | × | carlomagno quits (~cararell@inet-hqmc02-o.oracle.com) (Ping timeout: 240 seconds) |
| 2020-10-03 20:03:24 | × | mirrorbird quits (~psutcliff@2a00:801:42a:82eb:6edc:4c78:a574:2a8f) (Quit: Leaving) |
| 2020-10-03 20:03:43 | × | conal quits (~conal@66.115.157.135) (Quit: Computer has gone to sleep.) |
| 2020-10-03 20:07:16 | × | wroathe quits (~wroathe@c-73-24-27-54.hsd1.mn.comcast.net) (Ping timeout: 272 seconds) |
| 2020-10-03 20:08:26 | × | jle` quits (~mstksg@unaffiliated/mstksg) (Ping timeout: 256 seconds) |
| 2020-10-03 20:08:51 | × | voyons_osti quits (~dan@107-190-41-58.cpe.teksavvy.com) (Quit: Leaving) |
| 2020-10-03 20:10:38 | × | manwolf quits (~manwolf12@106.192.162.147) (Quit: Leaving) |
| 2020-10-03 20:10:56 | <koz_> | MaybeT IO Database |
| 2020-10-03 20:11:27 | × | GyroW_ quits (~GyroW@unaffiliated/gyrow) (Quit: Someone ate my pie) |
| 2020-10-03 20:11:37 | → | GyroW joins (~GyroW@d54C03E98.access.telenet.be) |
| 2020-10-03 20:11:37 | × | GyroW quits (~GyroW@d54C03E98.access.telenet.be) (Changing host) |
| 2020-10-03 20:11:37 | → | GyroW joins (~GyroW@unaffiliated/gyrow) |
| 2020-10-03 20:12:57 | <MarcelineVQ> | chad EitherT () IO Database vs simp MaybeT IO Database |
| 2020-10-03 20:13:26 | <koz_> | MarcelineVQ: ReaderT DatabaseStatus IO Database, for the FP Completionists. |
| 2020-10-03 20:13:36 | × | renzhi quits (~renzhi@modemcable070.17-177-173.mc.videotron.ca) (Ping timeout: 272 seconds) |
| 2020-10-03 20:13:38 | <MarcelineVQ> | fp completionists use RIO |
| 2020-10-03 20:13:48 | <koz_> | MarcelineVQ: My bad, lol. |
| 2020-10-03 20:14:01 | <koz_> | I clearly don't know enough about that world. |
| 2020-10-03 20:15:23 | × | danvet_ quits (~Daniel@2a02:168:57f4:0:efd0:b9e5:5ae6:c2fa) (Ping timeout: 272 seconds) |
| 2020-10-03 20:16:04 | → | rprije joins (~rprije@203.214.95.251) |
| 2020-10-03 20:16:54 | Citrouille | is now known as ping |
| 2020-10-03 20:19:55 | × | cole-h quits (~cole-h@c-73-48-197-220.hsd1.ca.comcast.net) (Ping timeout: 240 seconds) |
| 2020-10-03 20:19:56 | → | Super_Feeling joins (~Super_Fee@103.92.42.154) |
All times are in UTC.