Home liberachat/#haskell: Logs Calendar

Logs: liberachat/#haskell

←Prev  Next→ 1,803,044 events total
2021-07-19 20:36:34 × xff0x_ quits (~xff0x@2001:1a81:5299:ea00:2c16:bae7:eca6:fd06) (Ping timeout: 240 seconds)
2021-07-19 20:38:36 xff0x_ joins (~xff0x@185.65.135.235)
2021-07-19 20:44:51 × MQ-17J quits (~MQ-17J@d14-69-206-129.try.wideopenwest.com) (Ping timeout: 255 seconds)
2021-07-19 20:45:08 MQ-17J joins (~MQ-17J@d14-69-206-129.try.wideopenwest.com)
2021-07-19 20:45:10 spruit11_ joins (~quassel@2a02:a467:ccd6:1:11d0:89ea:1c73:9299)
2021-07-19 20:47:10 × BestSteve quits (~beststeve@220-135-3-239.HINET-IP.hinet.net) (Ping timeout: 245 seconds)
2021-07-19 20:47:31 × spruit11 quits (~quassel@2a02:a467:ccd6:1:b030:6032:2190:671b) (Ping timeout: 246 seconds)
2021-07-19 20:48:54 × xff0x_ quits (~xff0x@185.65.135.235) (Ping timeout: 258 seconds)
2021-07-19 20:48:54 BestSteve joins (~beststeve@2001-b011-0002-3b2a-06d9-f5ff-fe38-e249.dynamic-ip6.hinet.net)
2021-07-19 20:50:48 xff0x_ joins (~xff0x@2001:1a81:5299:ea00:2c16:bae7:eca6:fd06)
2021-07-19 20:51:36 × mjs2600 quits (~mjs2600@c-24-91-3-49.hsd1.vt.comcast.net) (Ping timeout: 255 seconds)
2021-07-19 20:52:23 eggplantade joins (~Eggplanta@108-201-191-115.lightspeed.sntcca.sbcglobal.net)
2021-07-19 20:52:40 argento joins (~argent0@168-227-96-26.ptr.westnet.com.ar)
2021-07-19 20:56:12 hexfive joins (~eric@50.35.83.177)
2021-07-19 20:56:48 acidjnk_new joins (~acidjnk@p200300d0c72b9588f8c9d06c34eef88c.dip0.t-ipconnect.de)
2021-07-19 20:57:36 × argento quits (~argent0@168-227-96-26.ptr.westnet.com.ar) (Quit: leaving)
2021-07-19 20:57:55 argento joins (~argent0@168-227-96-26.ptr.westnet.com.ar)
2021-07-19 20:58:26 × argento quits (~argent0@168-227-96-26.ptr.westnet.com.ar) (Client Quit)
2021-07-19 20:58:45 argento joins (~argent0@168-227-96-26.ptr.westnet.com.ar)
2021-07-19 20:59:05 oso joins (~oso@2601:58c:c080:a950:f275:2530:b398:680b)
2021-07-19 21:01:00 × argento quits (~argent0@168-227-96-26.ptr.westnet.com.ar) (Client Quit)
2021-07-19 21:01:02 <hseg> feels like this can be expressed in standard terms, any ideas? http://ix.io/3tsp
2021-07-19 21:01:20 argento joins (~argent0@168-227-96-26.ptr.westnet.com.ar)
2021-07-19 21:02:17 <hseg> idea is to sum a list, then if possible without changing the sign, replace the last element by its difference from the sum so it all sums to 0
2021-07-19 21:02:46 <hseg> (need to maintain signs, and the list is sorted by absolute value)
2021-07-19 21:03:35 × dunj3 quits (~dunj3@2001:16b8:3046:8200:9324:28de:5bca:d5dc) (Remote host closed the connection)
2021-07-19 21:05:07 × argento quits (~argent0@168-227-96-26.ptr.westnet.com.ar) (Client Quit)
2021-07-19 21:05:27 argento joins (~argent0@168-227-96-26.ptr.westnet.com.ar)
2021-07-19 21:05:47 × merijn quits (~merijn@83-160-49-249.ip.xs4all.nl) (Ping timeout: 252 seconds)
2021-07-19 21:06:05 × Vajb quits (~Vajb@hag-jnsbng11-58c3a1-224.dhcp.inet.fi) (Remote host closed the connection)
2021-07-19 21:06:47 × argento quits (~argent0@168-227-96-26.ptr.westnet.com.ar) (Client Quit)
2021-07-19 21:07:07 argento joins (~argent0@168-227-96-26.ptr.westnet.com.ar)
2021-07-19 21:07:50 <dsal> > let xs = init [1, 2, 3] in xs <> [0 - sum xs] -- hseg like this? I'm a bit confused by your specification.
2021-07-19 21:07:51 <lambdabot> [1,2,-3]
2021-07-19 21:08:01 Null_A joins (~null_a@2601:645:8700:2290:34e6:e307:f490:7d07)
2021-07-19 21:08:49 <hseg> spec is: (assuming output is Just): ((==) `on` compare 0) xs (fixSum xs), sum (fixSum xs) == 0
2021-07-19 21:09:35 <hseg> and I'm choosing to limit the cases i'm fixing to those (==) `on` init
2021-07-19 21:10:37 <hseg> hrm. your code is probably clearer -- just need to compose with a guard to make sure it satisfies spec
2021-07-19 21:10:52 Vajb joins (~Vajb@hag-jnsbng11-58c3a1-224.dhcp.inet.fi)
2021-07-19 21:10:54 <hseg> though if there were some way of avoiding the append, that would be nice
2021-07-19 21:12:07 × argento quits (~argent0@168-227-96-26.ptr.westnet.com.ar) (Quit: leaving)
2021-07-19 21:12:27 argento joins (~argent0@168-227-96-26.ptr.westnet.com.ar)
2021-07-19 21:13:59 <EvanR> you want to change the last element of a list?
2021-07-19 21:14:03 <hseg> y
2021-07-19 21:14:07 <EvanR> oof
2021-07-19 21:14:53 <hseg> could fix it so it's correct-by-construction, but that makes my generator code very ugly
2021-07-19 21:14:57 <EvanR> can you designate the first element the element that needs to be changed
2021-07-19 21:15:28 <hseg> nope -- sorted ascending by absolute value
2021-07-19 21:15:44 <EvanR> how about descending
2021-07-19 21:15:58 <hseg> and there's enough stuff depending on this already that I'd rather not push that redesign
2021-07-19 21:16:46 <hseg> should just take the l and continue -- probably not going to be significant enough to matter
2021-07-19 21:16:51 <hseg> (lists will be short)
2021-07-19 21:17:09 <hseg> at least it's O(n) vs O(1), not O(n) vs O(n^k)
2021-07-19 21:17:10 <EvanR> i like to split things up into steps rather than code golfing
2021-07-19 21:17:30 <hseg> ?
2021-07-19 21:17:44 <hseg> where are you seeing golfing in my code?
2021-07-19 21:17:49 <EvanR> or in this case, perhaps write a combinator that traverses a list and uses a function argument to decide how to modify the last element
2021-07-19 21:18:02 <EvanR> i only saw 1 line of code, so it seems like golf xD
2021-07-19 21:18:10 <hseg> :)
2021-07-19 21:18:44 <hseg> posted code earlier, but that could work
2021-07-19 21:19:04 spruit11 joins (~quassel@2a02:a467:ccd6:1:617d:c9ec:74dc:292b)
2021-07-19 21:19:05 × argento quits (~argent0@168-227-96-26.ptr.westnet.com.ar) (Quit: leaving)
2021-07-19 21:19:24 argento joins (~argent0@168-227-96-26.ptr.westnet.com.ar)
2021-07-19 21:19:42 <hseg> k, not bad enough to matter
2021-07-19 21:19:43 <EvanR> a combination fold and specialized list reconstructor. And scanl may already be that
2021-07-19 21:20:42 <davean> hseg: how does this handle the singleton list?
2021-07-19 21:20:48 × eggplantade quits (~Eggplanta@108-201-191-115.lightspeed.sntcca.sbcglobal.net) (Remote host closed the connection)
2021-07-19 21:21:04 <hseg> [0] -> Just [0], [x] -> Nothing
2021-07-19 21:21:14 × argento quits (~argent0@168-227-96-26.ptr.westnet.com.ar) (Client Quit)
2021-07-19 21:21:30 × spruit11_ quits (~quassel@2a02:a467:ccd6:1:11d0:89ea:1c73:9299) (Ping timeout: 240 seconds)
2021-07-19 21:21:31 <EvanR> oh failure, nvm
2021-07-19 21:21:41 <davean> Oh damn, thats ... ok
2021-07-19 21:21:53 argento joins (~argent0@168-227-96-26.ptr.westnet.com.ar)
2021-07-19 21:22:26 <EvanR> if you're changing the last element wouldn't [x] |-> Just [0]
2021-07-19 21:22:36 <davean> EvanR: Thats why I asked!
2021-07-19 21:23:01 × zeenk quits (~zeenk@2a02:2f04:a106:9600:82fb:aed9:ca9:38d3) (Ping timeout: 268 seconds)
2021-07-19 21:23:11 <davean> I had suspicions about the spec
2021-07-19 21:23:13 <hseg> no, because i need elementwise (==) `on` compare 0
2021-07-19 21:23:37 <hseg> which is more important to me than success fixing the sum
2021-07-19 21:24:30 <EvanR> less a spec and more a would be nice list xD
2021-07-19 21:24:44 <davean> Yah, I think you need to think about your actual problem space hseg
2021-07-19 21:24:52 <davean> I suspect you haven't come to understanding of your actual goals
2021-07-19 21:25:26 <hseg> am writing a quickcheck generator. all I need is that it generate enough correct values quickly
2021-07-19 21:25:42 <davean> No, thats not what you need for good quickchecks
2021-07-19 21:25:54 <davean> Thats what you need for invalid quickchecks
2021-07-19 21:26:09 <hseg> because I also need a good shrink?
2021-07-19 21:26:18 <hseg> (need one regardless (: )
2021-07-19 21:26:19 <davean> No, shrink is secondary and never required
2021-07-19 21:26:41 <davean> Quickcheck generators have to cover the domain, or at least the preimage
2021-07-19 21:26:54 <hseg> basically all I'm using this for is for randomly sampling the domain
2021-07-19 21:27:11 <davean> But you've just described NOT sampling the domain
2021-07-19 21:27:28 <davean> you'd just described sampling a particular subdomain of the domain
2021-07-19 21:28:03 <davean> And even suggested it isn't the preimage
2021-07-19 21:28:07 <davean> (strongly)
2021-07-19 21:28:36 <davean> Making the quickcheck results close to meaingless
2021-07-19 21:28:54 × cuz quits (~user@38.140.58.234) (Ping timeout: 268 seconds)
2021-07-19 21:29:01 <hseg> perhaps. am not using the full power of quickcheck, regardless
2021-07-19 21:29:11 <davean> This isn't about power, this is about validity
2021-07-19 21:29:32 × Erutuon quits (~Erutuon@user/erutuon) (Ping timeout: 258 seconds)
2021-07-19 21:29:38 <hseg> yes? so I know I will get false positives/negatives

All times are in UTC.