Logs: freenode/#haskell
| 2021-04-17 13:03:12 | <ski> | (and `foo (...) = foo (...) ++ foo (...)' will have this problem, for the right recursive call, but not for the left one) |
| 2021-04-17 13:03:53 | <ski> | you should be on the lookout for such potential sources of unreasonably inefficient list generations |
| 2021-04-17 13:05:29 | <ski> | "So if we take all values of bs separately, then it would be quadratic in length of bs." -- yes, if we actually were to take each `b' from `bs' at a time, and append ("snoc") it at the end. now, this is'nt what `as ++ bs' does (it "batches" all these individual appends together). however, the same problem can reoccur on a larger scale, as i outlined above |
| 2021-04-17 13:07:15 | <freegraph> | In case of foo () = foo () ++ foo (), I guess the compiler will be smart enough to do the right thing? |
| 2021-04-17 13:07:21 | <ski> | no |
| 2021-04-17 13:08:36 | <ski> | you probably should switch to d-lists or accumulator there, essentially doing `foo x = fooAppend x [] where ...; fooAppend (...) = fooAppend (...) . fooAppend (...)' |
| 2021-04-17 13:09:51 | <ski> | so `++' on `[a]'s is replaced by `.' on `[a] -> [a]'s. if the base case was `foo (...) = [x,y,z]', then the new base case will be `foo (...) = ([x,y,z] ++)', aka `foo (...) = (x:) . (y:) . (z:)' |
| 2021-04-17 13:10:17 | → | drbean_ joins (~drbean@TC210-63-209-26.static.apol.com.tw) |
| 2021-04-17 13:10:37 | → | ddellacosta joins (ddellacost@gateway/vpn/mullvad/ddellacosta) |
| 2021-04-17 13:10:43 | <ski> | or, we can express the same `fooAppend' explicitly (with an accumulator) as `fooAppend (...) acc = [x,y,z] ++ acc' for the base case, and `fooAppend (...) acc = fooAppend (...) (fooAppend (...) acc)' for the recursive case |
| 2021-04-17 13:12:28 | <ski> | exercise (in case you've seen custom data types yet ..), take `data Tree a = Leaf a | Branch (Tree a) (Tree a) deriving Show', and define `flatten :: Tree a -> [a]' to give the list of all the elements of the tree. both give a naïve definition (having the above efficiency problem), then give at least two versions that don't (along the two variants of `fooAppend' above) |
| 2021-04-17 13:12:51 | <ski> | then, do the same again, but for `data Tree a = Tip | Node (Tree a) a (Tree a) deriving Show' instead |
| 2021-04-17 13:12:58 | <liyang> | In situations where you know the length of the list will be limited (to say ~10 elements), it'll still probably be faster than something more sophisticated. For anything much longer, you need think about how you're producing and/or consuming the list. |
| 2021-04-17 13:13:07 | <ski> | freegraph : in case you want some more practice ^ |
| 2021-04-17 13:13:44 | <freegraph> | Not yet there. But I'll try this later |
| 2021-04-17 13:13:49 | <ski> | yes. often the right solution is to rethink, and possibly change data structure |
| 2021-04-17 13:14:14 | → | son0p joins (~ff@181.136.122.143) |
| 2021-04-17 13:14:56 | → | alex_sta joins (5f9d2408@95.157.36.8) |
| 2021-04-17 13:14:58 | × | ddellacosta quits (ddellacost@gateway/vpn/mullvad/ddellacosta) (Ping timeout: 240 seconds) |
| 2021-04-17 13:16:35 | ← | alex_sta parts (5f9d2408@95.157.36.8) () |
| 2021-04-17 13:16:35 | → | nbloomf joins (~nbloomf@2600:1700:ad14:3020:2548:b37b:2393:464b) |
| 2021-04-17 13:17:26 | <liyang> | Rethink and _benchmark_. Trust but _verify_. &c. &c. |
| 2021-04-17 13:17:38 | × | machinedgod quits (~machinedg@24.105.81.50) (Quit: Lost terminal) |
| 2021-04-17 13:18:45 | × | nbloomf quits (~nbloomf@2600:1700:ad14:3020:2548:b37b:2393:464b) (Client Quit) |
| 2021-04-17 13:18:51 | → | usr25 joins (~usr25@unaffiliated/usr25) |
| 2021-04-17 13:21:11 | → | machinedgod joins (~machinedg@24.105.81.50) |
| 2021-04-17 13:23:39 | × | olligobber quits (olligobber@gateway/vpn/privateinternetaccess/olligobber) (Remote host closed the connection) |
| 2021-04-17 13:27:00 | → | minoru_shiraeesh joins (~shiraeesh@5.101.59.131) |
| 2021-04-17 13:30:18 | → | merijn joins (~merijn@83-160-49-249.ip.xs4all.nl) |
| 2021-04-17 13:30:27 | × | wjp quits (~wjp@217.146.82.202) (Remote host closed the connection) |
| 2021-04-17 13:33:14 | × | hc quits (~hc@fsfe/hc) (Remote host closed the connection) |
| 2021-04-17 13:33:34 | → | dpl joins (~dpl@77-121-78-163.chn.volia.net) |
| 2021-04-17 13:36:43 | × | cheater quits (~user@unaffiliated/cheater) (Remote host closed the connection) |
| 2021-04-17 13:37:11 | → | roconnor joins (~roconnor@host-45-58-216-246.dyn.295.ca) |
| 2021-04-17 13:39:36 | → | cheater joins (~user@unaffiliated/cheater) |
| 2021-04-17 13:43:33 | → | hc joins (~hc@fsfe/hc) |
| 2021-04-17 13:44:09 | × | mauro^ quits (mauro@ip98-184-89-2.mc.at.cox.net) () |
| 2021-04-17 13:46:12 | × | machinedgod quits (~machinedg@24.105.81.50) (Ping timeout: 240 seconds) |
| 2021-04-17 13:48:11 | × | lawid quits (~quassel@2a02:8109:b5c0:5334:265e:beff:fe2a:dde8) (Ping timeout: 260 seconds) |
| 2021-04-17 13:49:23 | → | frozenErebus joins (~frozenEre@37.231.244.249) |
| 2021-04-17 13:49:46 | → | lawid joins (~quassel@2a02:8109:b5c0:5334:265e:beff:fe2a:dde8) |
| 2021-04-17 13:49:58 | → | ddellacosta joins (ddellacost@gateway/vpn/mullvad/ddellacosta) |
| 2021-04-17 13:51:11 | × | drbean_ quits (~drbean@TC210-63-209-26.static.apol.com.tw) (Quit: ZNC 1.8.2+cygwin2 - https://znc.in) |
| 2021-04-17 13:51:30 | → | dmytrish_ joins (~mitra@2a02:8084:a82:d900:319a:d200:a43d:3e3c) |
| 2021-04-17 13:52:13 | × | dmytrish_ quits (~mitra@2a02:8084:a82:d900:319a:d200:a43d:3e3c) (Read error: Connection reset by peer) |
| 2021-04-17 13:53:27 | → | dmytrish_ joins (~mitra@37.228.247.154) |
| 2021-04-17 13:53:55 | × | dmytrish quits (~mitra@2a02:8084:a82:d900:319a:d200:a43d:3e3c) (Ping timeout: 248 seconds) |
| 2021-04-17 13:54:26 | × | ddellacosta quits (ddellacost@gateway/vpn/mullvad/ddellacosta) (Ping timeout: 240 seconds) |
| 2021-04-17 13:54:55 | × | gnumonic quits (~gnumonic@c-73-170-91-210.hsd1.ca.comcast.net) (Ping timeout: 252 seconds) |
| 2021-04-17 13:56:14 | → | nicholasbulka joins (~nicholasb@2601:900:4301:da0:c8b6:8ee4:f90a:54d2) |
| 2021-04-17 13:57:53 | × | hendursa1 quits (~weechat@gateway/tor-sasl/hendursaga) (Quit: hendursa1) |
| 2021-04-17 14:00:39 | → | Tario joins (~Tario@201.192.165.173) |
| 2021-04-17 14:03:26 | × | merijn quits (~merijn@83-160-49-249.ip.xs4all.nl) (Ping timeout: 240 seconds) |
| 2021-04-17 14:04:32 | × | son0p quits (~ff@181.136.122.143) (Remote host closed the connection) |
| 2021-04-17 14:05:20 | → | hendursaga joins (~weechat@gateway/tor-sasl/hendursaga) |
| 2021-04-17 14:07:39 | → | dsrt^ joins (dsrt@ip98-184-89-2.mc.at.cox.net) |
| 2021-04-17 14:08:20 | → | nineonine joins (~nineonine@2604:3d08:7785:9600:68a6:8c79:2caf:5ce4) |
| 2021-04-17 14:10:45 | × | nicholasbulka quits (~nicholasb@2601:900:4301:da0:c8b6:8ee4:f90a:54d2) (Remote host closed the connection) |
| 2021-04-17 14:12:47 | × | dmytrish_ quits (~mitra@37.228.247.154) (Read error: Connection reset by peer) |
| 2021-04-17 14:13:04 | → | dmytrish_ joins (~mitra@2a02:8084:a82:d900:319a:d200:a43d:3e3c) |
| 2021-04-17 14:14:02 | × | nineonine quits (~nineonine@2604:3d08:7785:9600:68a6:8c79:2caf:5ce4) (Ping timeout: 258 seconds) |
| 2021-04-17 14:17:04 | → | son0p joins (~ff@181.136.122.143) |
| 2021-04-17 14:19:00 | <ij> | can I link to a section in haddock? |
| 2021-04-17 14:21:05 | <ij> | point to a section from the module exports marked by (-- * section header) from a definition |
| 2021-04-17 14:23:47 | × | dmytrish_ quits (~mitra@2a02:8084:a82:d900:319a:d200:a43d:3e3c) (Read error: Connection reset by peer) |
| 2021-04-17 14:23:58 | → | dmytrish_ joins (~mitra@2a02:8084:a82:d900:319a:d200:a43d:3e3c) |
| 2021-04-17 14:25:10 | → | ddellacosta joins (ddellacost@gateway/vpn/mullvad/ddellacosta) |
| 2021-04-17 14:27:23 | × | xff0x quits (~xff0x@2001:1a81:5285:4800:b119:894a:c62a:5c3d) (Ping timeout: 260 seconds) |
| 2021-04-17 14:28:03 | → | xff0x joins (~xff0x@2001:1a81:5285:4800:4b3b:6e1b:c5f9:114d) |
| 2021-04-17 14:29:32 | → | heatsink joins (~heatsink@108-201-191-115.lightspeed.sntcca.sbcglobal.net) |
| 2021-04-17 14:29:45 | × | ddellacosta quits (ddellacost@gateway/vpn/mullvad/ddellacosta) (Ping timeout: 260 seconds) |
| 2021-04-17 14:31:12 | → | Pickchea joins (~private@unaffiliated/pickchea) |
| 2021-04-17 14:34:11 | × | heatsink quits (~heatsink@108-201-191-115.lightspeed.sntcca.sbcglobal.net) (Ping timeout: 240 seconds) |
| 2021-04-17 14:37:36 | → | nbloomf joins (~nbloomf@2600:1700:ad14:3020:2548:b37b:2393:464b) |
| 2021-04-17 14:38:11 | <connrs> | /set irc.look.buffer_switch_autojoin off |
| 2021-04-17 14:39:05 | × | usr25 quits (~usr25@unaffiliated/usr25) (Quit: Leaving) |
| 2021-04-17 14:39:50 | <liyang> | ij: yes http://hackage.haskell.org/package/base-4.15.0.0/docs/Data-List.html#g:2 |
| 2021-04-17 14:40:01 | × | dmytrish_ quits (~mitra@2a02:8084:a82:d900:319a:d200:a43d:3e3c) (Quit: Konversation terminated!) |
| 2021-04-17 14:40:07 | <liyang> | connrs: maybe you meant /DISCO ? |
| 2021-04-17 14:40:12 | <ij> | liyang, from the docs themselves, that is |
| 2021-04-17 14:40:16 | → | dmytrish_ joins (~mitra@2a02:8084:a82:d900:319a:d200:a43d:3e3c) |
| 2021-04-17 14:41:17 | connrs | slowly closes down all IRC accounts in shame and goes to live in the woods making pottery and weaving wicker baskets for the rest of time |
| 2021-04-17 14:42:04 | <liyang> | Oh hum, probably not reliably—you could try to guess what Haddock will number your section perhaps. Although with the recent (last few years) Markdown extensions may give you some other options, I don't know. |
| 2021-04-17 14:43:03 | <juri_> | connrs: you can attone. you just need to write a haskell library that gets over a thousand stars on github. |
| 2021-04-17 14:43:25 | × | hc quits (~hc@fsfe/hc) (Remote host closed the connection) |
| 2021-04-17 14:44:18 | → | GothAlice1 joins (~GothAlice@217.146.82.202) |
| 2021-04-17 14:46:38 | → | lambdaman joins (~lambdaman@s66-183-152-156.bc.hsia.telus.net) |
| 2021-04-17 14:49:59 | × | elliott_ quits (~elliott_@pool-108-18-30-46.washdc.fios.verizon.net) (Read error: Connection reset by peer) |
| 2021-04-17 14:51:26 | × | lambdaman quits (~lambdaman@s66-183-152-156.bc.hsia.telus.net) (Ping timeout: 240 seconds) |
| 2021-04-17 14:52:21 | → | elliott_ joins (~elliott_@pool-108-18-30-46.washdc.fios.verizon.net) |
| 2021-04-17 14:52:28 | → | vicfred joins (~vicfred@unaffiliated/vicfred) |
| 2021-04-17 14:54:28 | × | pavonia quits (~user@unaffiliated/siracusa) (Quit: Bye!) |
| 2021-04-17 15:00:32 | → | ddellacosta joins (ddellacost@gateway/vpn/mullvad/ddellacosta) |
| 2021-04-17 15:00:36 | → | Gurkenglas joins (~Gurkengla@unaffiliated/gurkenglas) |
| 2021-04-17 15:01:04 | × | dmytrish_ quits (~mitra@2a02:8084:a82:d900:319a:d200:a43d:3e3c) (Quit: Konversation terminated!) |
| 2021-04-17 15:01:18 | → | dmytrish_ joins (~mitra@2a02:8084:a82:d900:936:d944:8db0:5069) |
| 2021-04-17 15:04:49 | × | jamm_ quits (~jamm@unaffiliated/jamm) (Remote host closed the connection) |
| 2021-04-17 15:05:19 | × | ddellacosta quits (ddellacost@gateway/vpn/mullvad/ddellacosta) (Ping timeout: 252 seconds) |
| 2021-04-17 15:05:43 | → | jamm_ joins (~jamm@unaffiliated/jamm) |
| 2021-04-17 15:07:06 | × | dmytrish_ quits (~mitra@2a02:8084:a82:d900:936:d944:8db0:5069) (Quit: Konversation terminated!) |
All times are in UTC.