Logs: freenode/#haskell
| 2021-04-22 15:33:57 | × | cr3 quits (~cr3@192-222-143-195.qc.cable.ebox.net) (Ping timeout: 252 seconds) |
| 2021-04-22 15:34:01 | <tomsmeding> | % let s2 [] = [[]]; s2 (x:xs) = let ss2 _ [] = [] ; ss2 x (y:ys) = (x:y) : y : ss2 x ys in ss2 x (s2 xs) |
| 2021-04-22 15:34:01 | <yahb> | tomsmeding: |
| 2021-04-22 15:34:02 | → | Sheilong joins (uid293653@gateway/web/irccloud.com/x-qhaitevlgmfrqfwo) |
| 2021-04-22 15:34:11 | <tomsmeding> | % s1 [1..3] |
| 2021-04-22 15:34:12 | <yahb> | tomsmeding: [[1,2,3],[1,2],[1,3],[1],[2,3],[2],[3],[]] |
| 2021-04-22 15:34:15 | <tomsmeding> | % s2 [1..3] |
| 2021-04-22 15:34:15 | <yahb> | tomsmeding: [[1,2,3],[2,3],[1,3],[3],[1,2],[2],[1],[]] |
| 2021-04-22 15:34:29 | <tomsmeding> | ghc isn't going to do optimisations that change semantics :p |
| 2021-04-22 15:35:39 | → | heatsink joins (~heatsink@108-201-191-115.lightspeed.sntcca.sbcglobal.net) |
| 2021-04-22 15:36:14 | × | nineonine quits (~nineonine@2604:3d08:7785:9600:5c9e:8d21:d745:3944) (Ping timeout: 245 seconds) |
| 2021-04-22 15:36:14 | <zzz> | i knew that would be the answer :) you can rewrite it so that it would be the same though, can't you? |
| 2021-04-22 15:36:27 | × | Kaiepi quits (~Kaiepi@47.54.252.148) (Read error: Connection reset by peer) |
| 2021-04-22 15:36:38 | <tomsmeding> | incidentally this is why I like let-expressions better than while blocks for smaller things (excepting large helper methods); you can much more easily rewrite stuff because everything is compositional |
| 2021-04-22 15:36:42 | → | Kaiepi joins (~Kaiepi@47.54.252.148) |
| 2021-04-22 15:36:58 | <tomsmeding> | zzz: can you? |
| 2021-04-22 15:37:24 | <c_wraith> | let's see what the list monad says! |
| 2021-04-22 15:37:26 | <c_wraith> | > filterM (const [True, False]) [1,2,3] |
| 2021-04-22 15:37:27 | <lambdabot> | [[1,2,3],[1,2],[1,3],[1],[2,3],[2],[3],[]] |
| 2021-04-22 15:37:38 | <c_wraith> | ok, yeah, that makes sense |
| 2021-04-22 15:39:15 | → | vicfred joins (~vicfred@unaffiliated/vicfred) |
| 2021-04-22 15:43:06 | × | malumore quits (~malumore@151.62.117.136) (Ping timeout: 240 seconds) |
| 2021-04-22 15:43:11 | → | knupfer joins (~Thunderbi@200116b82b4d2f00ccb7bffffea9a8f6.dip.versatel-1u1.de) |
| 2021-04-22 15:43:54 | × | knupfer quits (~Thunderbi@200116b82b4d2f00ccb7bffffea9a8f6.dip.versatel-1u1.de) (Remote host closed the connection) |
| 2021-04-22 15:44:02 | → | knupfer joins (~Thunderbi@200116b82b4d2f00a98dd2f64b7ff0a2.dip.versatel-1u1.de) |
| 2021-04-22 15:44:31 | → | nineonine joins (~nineonine@2604:3d08:7785:9600:5c9e:8d21:d745:3944) |
| 2021-04-22 15:44:36 | <zzz> | thank you for that |
| 2021-04-22 15:44:41 | × | TheCavalry quits (~TheCavalr@217.146.82.202) (Ping timeout: 260 seconds) |
| 2021-04-22 15:44:59 | <c_wraith> | it's exactly the same algorithm as your second version |
| 2021-04-22 15:45:08 | <c_wraith> | It just uses more built-in tooling |
| 2021-04-22 15:46:28 | <zzz> | tomsmeding: i don't get your let vs while argument. can you clarify? |
| 2021-04-22 15:46:44 | × | chele quits (~chele@5.53.222.202) (Remote host closed the connection) |
| 2021-04-22 15:46:51 | <c_wraith> | But yeah... when micro-optimizing things in this neighborhood, you usually get the best performance by carefully working to maximize sharing between adjacent results. this results in less garbage collection drag. |
| 2021-04-22 15:47:17 | <tomsmeding> | zzz: completely subjective argument, don't attach too much value to it :) |
| 2021-04-22 15:47:34 | <tomsmeding> | point was that in let-form, I can inline stuff so that it becomes a one-liner without thinking |
| 2021-04-22 15:47:50 | <tomsmeding> | in where-form, the scoping of that where block is very much unclear to me |
| 2021-04-22 15:47:52 | <c_wraith> | but that requires being careful about the order results are produced in. You can't just change the order without affecting the performance. |
| 2021-04-22 15:47:58 | <zzz> | tomsmeding: ah ok! you said "composition" and it confused me |
| 2021-04-22 15:48:13 | <tomsmeding> | "compositional" != "composition" |
| 2021-04-22 15:48:29 | <zzz> | got it |
| 2021-04-22 15:48:30 | <tomsmeding> | compositional = subexpressions have the same form as the whole expression |
| 2021-04-22 15:48:33 | × | raehik1 quits (~raehik@cpc95906-rdng25-2-0-cust156.15-3.cable.virginm.net) (Quit: WeeChat 3.1) |
| 2021-04-22 15:48:38 | <tomsmeding> | "you can compose stuff arbitrarily" |
| 2021-04-22 15:48:56 | → | raehik joins (~raehik@cpc95906-rdng25-2-0-cust156.15-3.cable.virginm.net) |
| 2021-04-22 15:49:31 | × | nineonine quits (~nineonine@2604:3d08:7785:9600:5c9e:8d21:d745:3944) (Ping timeout: 250 seconds) |
| 2021-04-22 15:50:18 | <tomsmeding> | fun fact, my ghc realises that the first and second versions are really the same thing and does no work at all for the second function if you evaluate them one after another |
| 2021-04-22 15:50:23 | <tomsmeding> | oh the joys of benchmarking |
| 2021-04-22 15:50:32 | → | nineonine joins (~nineonine@50.216.62.2) |
| 2021-04-22 15:50:55 | <c_wraith> | like, an order optimizing sharing might look like [[],[1],[2],[1,2],[3],[1,3],[2,3],[1,2,3]] |
| 2021-04-22 15:51:32 | <c_wraith> | (admittedly, not much sharing to be found when looking at a max of 3 elements) |
| 2021-04-22 15:54:54 | <zzz> | > filterM (const [False,True]) [1,2,3] |
| 2021-04-22 15:54:56 | <lambdabot> | [[],[3],[2],[2,3],[1],[1,3],[1,2],[1,2,3]] |
| 2021-04-22 15:55:04 | <zzz> | :( |
| 2021-04-22 15:55:21 | <c_wraith> | ... ok, that particular order probably doesn't have great algorithms for. There are other ways to approach it that probably get you better results. |
| 2021-04-22 15:55:44 | <c_wraith> | But it does have shared sublists as adjacent as possible, which was my goal |
| 2021-04-22 15:57:47 | → | idhugo_ joins (~idhugo@87-49-147-45-mobile.dk.customer.tdc.net) |
| 2021-04-22 15:57:49 | <c_wraith> | I think it'd be easier to write an algorithm for [[3],[2,3],[1,2,3],[1,3],[2],[1,2],[1],[]] |
| 2021-04-22 15:58:03 | <tomsmeding> | I have a function that produces [[3,2,1],[2,1],[3,1],[1],[3,2],[2],[3],[]] |
| 2021-04-22 15:58:36 | <tomsmeding> | but it's only marginally faster than the map version, and zzz's third function is a lot faster still |
| 2021-04-22 15:58:51 | <zzz> | for this particular problem i would just generate 2^n binary numbers where 000 => [] , 001 => [1] , 010 => [2] , ... 110 => [2,3] , 111 => [1,2,3] |
| 2021-04-22 15:59:39 | <tomsmeding> | c_wraith: s4 input = let go base [] = [base] ; go base (x:xs) = go (x : base) xs ++ go base xs in go [] input |
| 2021-04-22 16:00:16 | × | slaterr quits (~bc8134e3@199.204.85.195) (Quit: CGI:IRC (Session timeout)) |
| 2021-04-22 16:00:27 | <c_wraith> | It's true, I was maintaining the subsequence property, instead of allowing myself to go to subset as the name implies |
| 2021-04-22 16:01:02 | × | merijn quits (~merijn@83-160-49-249.ip.xs4all.nl) (Ping timeout: 265 seconds) |
| 2021-04-22 16:01:32 | → | Rudd0 joins (~Rudd0@185.189.115.103) |
| 2021-04-22 16:04:54 | × | Narinas quits (~Narinas@187-178-93-112.dynamic.axtel.net) (Ping timeout: 265 seconds) |
| 2021-04-22 16:10:43 | × | conal quits (~conal@64.71.133.70) (Read error: Connection reset by peer) |
| 2021-04-22 16:12:04 | <zzz> | filterM is fun |
| 2021-04-22 16:13:23 | → | conal joins (~conal@64.71.133.70) |
| 2021-04-22 16:14:27 | → | malumore joins (~malumore@151.62.117.136) |
| 2021-04-22 16:15:48 | → | ep1ctetus joins (~epictetus@ip72-194-54-201.sb.sd.cox.net) |
| 2021-04-22 16:16:24 | × | hendursaga quits (~weechat@gateway/tor-sasl/hendursaga) (Remote host closed the connection) |
| 2021-04-22 16:16:47 | → | hendursaga joins (~weechat@gateway/tor-sasl/hendursaga) |
| 2021-04-22 16:21:20 | × | bedforddriggs quits (60fa4ff9@pool-96-250-79-249.nycmny.fios.verizon.net) (Quit: Connection closed) |
| 2021-04-22 16:22:54 | × | kritzefitz quits (~kritzefit@2003:5b:203b:200::10:49) (Remote host closed the connection) |
| 2021-04-22 16:22:58 | → | Narinas joins (~Narinas@187-178-93-112.dynamic.axtel.net) |
| 2021-04-22 16:28:00 | × | kuribas quits (~user@ip-188-118-57-242.reverse.destiny.be) (Remote host closed the connection) |
| 2021-04-22 16:28:05 | × | haasn quits (~nand@mpv/developer/haasn) (Quit: ZNC 1.7.5+deb4 - https://znc.in) |
| 2021-04-22 16:29:02 | → | band joins (~band@104-57-176-102.lightspeed.austtx.sbcglobal.net) |
| 2021-04-22 16:29:19 | → | haasn joins (~nand@mpv/developer/haasn) |
| 2021-04-22 16:30:43 | → | tzh joins (~tzh@c-24-21-73-154.hsd1.or.comcast.net) |
| 2021-04-22 16:31:35 | → | kritzefitz joins (~kritzefit@212.86.56.80) |
| 2021-04-22 16:31:42 | → | merijn joins (~merijn@83-160-49-249.ip.xs4all.nl) |
| 2021-04-22 16:32:46 | <band> | new haskell / cabal user here: installing pdftotext with cabal yields poppler.cc C++ extension errors. suggestions for fixing? |
| 2021-04-22 16:33:21 | <band> | er, that it "C++11 extensions" errors |
| 2021-04-22 16:33:40 | → | nut joins (~gtk@roc37-h01-176-170-197-243.dsl.sta.abo.bbox.fr) |
| 2021-04-22 16:36:50 | × | merijn quits (~merijn@83-160-49-249.ip.xs4all.nl) (Ping timeout: 246 seconds) |
| 2021-04-22 16:40:36 | → | merijn joins (~merijn@83-160-49-249.ip.xs4all.nl) |
| 2021-04-22 16:45:13 | <fendor> | band, maybe pdftotext requires an old poppler version? So, it might need updating |
| 2021-04-22 16:45:32 | × | merijn quits (~merijn@83-160-49-249.ip.xs4all.nl) (Ping timeout: 240 seconds) |
| 2021-04-22 16:45:33 | → | elfets_ joins (~elfets@ip-37-201-23-96.hsi13.unitymediagroup.de) |
| 2021-04-22 16:46:30 | <fendor> | seems like pdftotext compiles some c++ sources. not sure there is an easy fix |
| 2021-04-22 16:46:40 | × | heatsink quits (~heatsink@108-201-191-115.lightspeed.sntcca.sbcglobal.net) (Remote host closed the connection) |
| 2021-04-22 16:47:21 | → | puke joins (~vroom@217.138.252.184) |
| 2021-04-22 16:48:00 | <band> | fendor, thanks for the response -- much appreciated. |
| 2021-04-22 16:48:51 | × | elfets quits (~elfets@ip-37-201-23-96.hsi13.unitymediagroup.de) (Ping timeout: 260 seconds) |
| 2021-04-22 16:51:31 | → | kupi joins (uid212005@gateway/web/irccloud.com/x-wwoexcijnelowmiu) |
| 2021-04-22 16:51:50 | → | s00pcan joins (~chris@075-133-056-178.res.spectrum.com) |
| 2021-04-22 16:53:45 | → | hypercube joins (hypercube@gateway/vpn/protonvpn/hypercube) |
| 2021-04-22 16:54:10 | × | stree quits (~stree@68.36.8.116) (Ping timeout: 260 seconds) |
All times are in UTC.