Logs: freenode/#haskell
| 2021-04-19 16:35:46 | × | mctpyt quits (~mctpyt@unaffiliated/mctpyt) (Ping timeout: 240 seconds) |
| 2021-04-19 16:37:34 | → | basenode joins (~user@gateway/tor-sasl/basenode) |
| 2021-04-19 16:37:39 | <basenode> | hello? |
| 2021-04-19 16:37:42 | → | acarrico joins (~acarrico@dhcp-68-142-39-249.greenmountainaccess.net) |
| 2021-04-19 16:37:42 | → | Tuplanolla joins (~Tuplanoll@91-159-68-239.elisa-laajakaista.fi) |
| 2021-04-19 16:38:02 | → | mctpyt joins (~mctpyt@unaffiliated/mctpyt) |
| 2021-04-19 16:38:20 | <sm[m]> | hello |
| 2021-04-19 16:39:15 | × | hiroaki_ quits (~hiroaki@2a02:8108:8c40:2bb8:32e1:d1a7:8b3e:afc2) (Ping timeout: 260 seconds) |
| 2021-04-19 16:39:19 | <basenode> | hi, i have a quick question: is it possible to convert a (previously nested) flattened (ordered) list to a nested structure with O(n) complexity recursively? |
| 2021-04-19 16:41:19 | <basenode> | i.e. [{id: 1, parent_id: nil}, {id: 2, parent_id: 1}, {id: 3: parent_id: nil}] to [{id: 1, children: [{id: 2}]}, {id: 2, children: []}] |
| 2021-04-19 16:41:55 | × | minoru_shiraeesh quits (~shiraeesh@109.166.57.43) (Ping timeout: 252 seconds) |
| 2021-04-19 16:42:19 | <sm[m]> | I don't know if this will help, but did you know it's possible to have a flat list that is also a nested tree ? |
| 2021-04-19 16:42:53 | ← | morkessa parts (~kelsey@096-033-168-208.res.spectrum.com) () |
| 2021-04-19 16:43:20 | <sm[m]> | sorry, I don't know the answer to your q |
| 2021-04-19 16:43:57 | <basenode> | sm[m]: no problem, thanks anyway |
| 2021-04-19 16:43:58 | <sm[m]> | but I'll guess yes |
| 2021-04-19 16:44:11 | <basenode> | i feel like its yes too, but i just don't know how to do it |
| 2021-04-19 16:45:30 | → | frozenErebus joins (~frozenEre@37.231.244.249) |
| 2021-04-19 16:47:17 | → | gitgood joins (~gitgood@80-44-9-246.dynamic.dsl.as9105.com) |
| 2021-04-19 16:47:37 | <sm[m]> | maybe https://hackage.haskell.org/package/hledger-lib-1.21/docs/src/Hledger.Utils.Tree.html gives ideas |
| 2021-04-19 16:48:04 | <wroathe> | basenode: It would be O(n) for iterating the source array, but inserting into the target tree will likely require an O(log(n)) lookup |
| 2021-04-19 16:48:08 | → | geiger_ joins (~geiger@90.212.77.86) |
| 2021-04-19 16:48:21 | × | rj quits (~x@gateway/tor-sasl/rj) (Ping timeout: 240 seconds) |
| 2021-04-19 16:48:36 | → | howdoi joins (uid224@gateway/web/irccloud.com/x-pwqigqguzpkhpeqf) |
| 2021-04-19 16:49:18 | × | mctpyt quits (~mctpyt@unaffiliated/mctpyt) (Quit: WeeChat 3.1) |
| 2021-04-19 16:49:33 | <wroathe> | basenode: You'll be looking up nodes by parent id in the target tree |
| 2021-04-19 16:50:13 | × | frozenErebus quits (~frozenEre@37.231.244.249) (Ping timeout: 240 seconds) |
| 2021-04-19 16:50:56 | → | idhugo_ joins (~idhugo@87.49.147.45) |
| 2021-04-19 16:51:25 | × | geiger quits (~geiger@90.212.77.86) (Ping timeout: 260 seconds) |
| 2021-04-19 16:51:58 | → | rj joins (~x@gateway/tor-sasl/rj) |
| 2021-04-19 16:52:27 | × | Techcable quits (~Techcable@168.235.93.147) (Quit: ZNC - https://znc.in) |
| 2021-04-19 16:55:09 | → | Techcable joins (~Techcable@168.235.93.147) |
| 2021-04-19 16:55:43 | <basenode> | wroathe: ah ok, i thought i might be able to iterate over each element only once |
| 2021-04-19 16:56:08 | → | minoru_shiraeesh joins (~shiraeesh@109.166.57.43) |
| 2021-04-19 16:56:51 | <wroathe> | basenode: Oh, I missed the detail where you said they were sorted |
| 2021-04-19 16:56:58 | <wroathe> | basenode: If they're sorted you can |
| 2021-04-19 16:57:01 | <basenode> | ah |
| 2021-04-19 16:57:16 | <basenode> | yeah that's quite an important detail i think ;) |
| 2021-04-19 16:57:46 | × | gnumonic quits (~gnumonic@c-73-170-91-210.hsd1.ca.comcast.net) (Ping timeout: 240 seconds) |
| 2021-04-19 17:03:18 | <basenode> | wroathe: any idea what the general algorithm for this would look like? |
| 2021-04-19 17:04:32 | → | frozenErebus joins (~frozenEre@37.231.244.249) |
| 2021-04-19 17:07:22 | → | unlink_ joins (~unlink2@p57b8541f.dip0.t-ipconnect.de) |
| 2021-04-19 17:08:13 | × | unlink2 quits (~unlink2@p57b853bf.dip0.t-ipconnect.de) (Ping timeout: 240 seconds) |
| 2021-04-19 17:08:55 | × | ADG1089 quits (~aditya@223.236.174.241) (Quit: Konversation terminated!) |
| 2021-04-19 17:09:06 | × | frozenErebus quits (~frozenEre@37.231.244.249) (Ping timeout: 260 seconds) |
| 2021-04-19 17:10:26 | × | heatsink quits (~heatsink@108-201-191-115.lightspeed.sntcca.sbcglobal.net) (Remote host closed the connection) |
| 2021-04-19 17:11:32 | <wroathe> | basenode: The basic idea is just to leverage the call stack to store a reference to the current parent node and to iterate while the child's parent id matches the current parent |
| 2021-04-19 17:13:20 | × | coot quits (~coot@37.30.50.130.nat.umts.dynamic.t-mobile.pl) (Quit: coot) |
| 2021-04-19 17:14:30 | × | kenanmarasli quits (1fdf0934@31.223.9.52) (Quit: Connection closed) |
| 2021-04-19 17:15:20 | → | kritzefitz joins (~kritzefit@212.86.56.80) |
| 2021-04-19 17:16:58 | <basenode> | wroathe: been trying to do that for the last few hours to not much success :P |
| 2021-04-19 17:17:13 | × | idhugo_ quits (~idhugo@87.49.147.45) (Ping timeout: 240 seconds) |
| 2021-04-19 17:17:19 | × | kristijonas quits (~kristijon@78-56-32-39.static.zebra.lt) (Remote host closed the connection) |
| 2021-04-19 17:17:52 | → | kristijonas joins (~kristijon@78-56-32-39.static.zebra.lt) |
| 2021-04-19 17:18:13 | → | ph88 joins (~ph88@2a02:8109:9e00:7e5c:d5ef:86b3:afc4:9258) |
| 2021-04-19 17:18:16 | <wroathe> | uno momento |
| 2021-04-19 17:19:14 | → | merijn joins (~merijn@83-160-49-249.ip.xs4all.nl) |
| 2021-04-19 17:20:19 | × | kristijonas quits (~kristijon@78-56-32-39.static.zebra.lt) (Remote host closed the connection) |
| 2021-04-19 17:20:47 | → | kristijonas joins (~kristijon@78-56-32-39.static.zebra.lt) |
| 2021-04-19 17:21:52 | <basenode> | sure |
| 2021-04-19 17:22:18 | × | kristijonas quits (~kristijon@78-56-32-39.static.zebra.lt) (Max SendQ exceeded) |
| 2021-04-19 17:22:39 | <basenode> | im wondering, i was initially using 2 parameters in my recursion function, initial and final (where initial is the flat array, and final the nestd array) |
| 2021-04-19 17:22:56 | <basenode> | but maybe i need a 3 parameter to keep track of a particular tree? |
| 2021-04-19 17:23:17 | → | kuribas joins (~user@ptr-25vy0i8idggkot642u8.18120a2.ip6.access.telenet.be) |
| 2021-04-19 17:23:28 | <barakkl1993> | hey, I just can't see how to change this list comprehension to map and filter, [x | x <- [1..],x % 3 == 0|| x % 5 == 0, x < 1000] |
| 2021-04-19 17:24:11 | → | kristijonas joins (~kristijon@78-56-32-39.static.zebra.lt) |
| 2021-04-19 17:24:33 | × | rajivr quits (uid269651@gateway/web/irccloud.com/x-ozfaqobeqdbxwvmv) (Quit: Connection closed for inactivity) |
| 2021-04-19 17:24:42 | × | kristijonas quits (~kristijon@78-56-32-39.static.zebra.lt) (Max SendQ exceeded) |
| 2021-04-19 17:25:23 | × | xff0x quits (~xff0x@2001:1a81:52f2:b700:a7c9:31ec:b9a1:9e16) (Ping timeout: 250 seconds) |
| 2021-04-19 17:26:14 | → | xff0x joins (~xff0x@2001:1a81:52f2:b700:d92:ea7f:92b1:dda) |
| 2021-04-19 17:27:49 | × | barakkl1993 quits (~barakkley@2.55.190.28) (Ping timeout: 260 seconds) |
| 2021-04-19 17:30:53 | × | barzo quits (~sosal@159.146.53.142) (Read error: Connection reset by peer) |
| 2021-04-19 17:31:09 | × | rj quits (~x@gateway/tor-sasl/rj) (Ping timeout: 240 seconds) |
| 2021-04-19 17:33:32 | ski | . o O ( "ParentTree.hs" <https://paste.tomsmeding.com/7DyPxjR6> ) |
| 2021-04-19 17:36:08 | <wroathe> | basenode: Yeah, use ski's link. I'm too distracted by this Chauvin trial to be any use. |
| 2021-04-19 17:36:12 | → | rj joins (~x@gateway/tor-sasl/rj) |
| 2021-04-19 17:36:15 | × | werneta quits (~werneta@70-142-214-115.lightspeed.irvnca.sbcglobal.net) (Quit: Lost terminal) |
| 2021-04-19 17:36:28 | <tomsmeding> | n log n though |
| 2021-04-19 17:37:35 | <tomsmeding> | basenode: are you fine with ST and mutable vectors? :p |
| 2021-04-19 17:37:35 | <ski> | you could use an array/vector, and map over it |
| 2021-04-19 17:38:01 | <ski> | (assuming you can use your IDs as indices) |
| 2021-04-19 17:39:28 | ski | idly notes that the paste on the page doesn't display the form feed |
| 2021-04-19 17:39:36 | × | hypercube quits (hypercube@gateway/vpn/protonvpn/hypercube) (Ping timeout: 265 seconds) |
| 2021-04-19 17:40:02 | <tomsmeding> | ski: the form feed is there in the html, your browser just doesn't do anything with it :p |
| 2021-04-19 17:40:13 | <tomsmeding> | in fact I'm not sure what it _should_ do |
| 2021-04-19 17:40:27 | <ski> | yea, i noticed it in the raw form |
| 2021-04-19 17:40:43 | <ski> | i'm not sure if it should do anything special, either .. just noticed it |
| 2021-04-19 17:41:04 | <tomsmeding> | where did the form feed come from |
| 2021-04-19 17:41:15 | <ski> | i entered it into the source, as a section separation |
| 2021-04-19 17:41:58 | <ski> | (you can navigate to previous/next page, in Emacs, using `C-x [' / `C-x ]') |
| 2021-04-19 17:43:40 | <ski> | (i tend to sometimes enter those, trying to keep pages under sixtysix lines, per the suggestion under `*** Pagination' at Riastradh's <https://mumble.net/~campbell/scheme/style.txt>) |
| 2021-04-19 17:44:10 | <unyu> | ski: `C-x [` seems to go to the top of the buffer, not just the previous page. |
| 2021-04-19 17:44:22 | <ski> | if you're already on the first page, sure |
| 2021-04-19 17:44:48 | <unyu> | I'm nowhere near the first page on this very buffer. |
| 2021-04-19 17:45:11 | × | Geekingfrog quits (geekingfro@2a01:7e01::f03c:92ff:fe48:8bdf) (Quit: ZNC 1.8.2 - https://znc.in) |
| 2021-04-19 17:45:20 | <ski> | `C-x [' is bound to `backward-page', here. perhaps you have some other binding |
| 2021-04-19 17:45:32 | <ski> | (and `C-x ]' to `forward-page') |
| 2021-04-19 17:45:35 | <unyu> | Ah... |
| 2021-04-19 17:45:59 | × | geekosaur quits (930099da@rrcs-147-0-153-218.central.biz.rr.com) (Quit: Connection closed) |
| 2021-04-19 17:46:38 | → | jamm_ joins (~jamm@unaffiliated/jamm) |
All times are in UTC.