code logs -> 2021 -> Thu, 21 Oct 2021< code.20211020.log - code.20211022.log >
--- Log opened Thu Oct 21 00:00:01 2021
02:22 Vornicus [Vorn@ServerAdministrator.Nightstar.Net] has quit [Connection closed]
03:06 * ToxicFrog pokes this with a stick
03:07
<&ToxicFrog>
I have a seq of structs.
03:07
<&ToxicFrog>
I need to filter out the first N entries in the seq such that (from-me? %) is true; N will vary across calls.
03:08
<&ToxicFrog>
I need to do this without otherwise affecting the contents or order of the seq.
03:09
<&McMartin>
So, in Haskell, that would be a call to `take N` on a comprehension filter of the seq.
03:10
<&ToxicFrog>
drop N, surely?
03:10
<&McMartin>
I misunderstood what you meant by "filter out". drop N will not do it.
03:10
<&McMartin>
I read it as "extract".
03:10
<&ToxicFrog>
Oh no, I mean "remove"
03:10
<&ToxicFrog>
That does give me an idea though
03:10
<&McMartin>
Yeah
03:11
<&McMartin>
Doing it *efficiently* would probably end up producing a "drop-if" like function with a limiter on it, so that I could connect my filtered prefix to The Rest of The List.
03:11
<&ToxicFrog>
(let [to-remove (->> xs (filter from-me?) (take N) set)]
03:11
<&ToxicFrog>
(filter (complement to-remove) xs))
03:12
<&McMartin>
That looks vaguely right
03:12
<&McMartin>
If xs is large, though, this might do a butt-ton of unnecessary allocation.
03:16
<&ToxicFrog>
xs and N are both usually going to be <5, although in rare cases xs will have 100-200 elements in it (and N will be 0)
03:16
<&ToxicFrog>
clojure does structural sharing, though, so the number of allocations needed should be minimal
03:17
<&McMartin>
What I'm worried about is that filter will not be able to deduce that it *can* share the structure as you've written it
03:17
<&ToxicFrog>
I mean, it'll allocate a new lazy-seq, but none of the actual seq contents will be copied
03:17
<&McMartin>
Because it's going to go "oh but what if the last element of the seq is in to-remove, better copy everything along the way"
03:17
<&McMartin>
Oh, these are lazy seqs
03:18
<&ToxicFrog>
These are lazy seqs of immutable data structures
03:18
<&ToxicFrog>
So it can take a lot of shortcuts because (a) only the parts I actually need will be evaluated and (b) it knows they cannot be modified in-place
03:18
<&McMartin>
OK, this "should" just be moving pointers around inside of it then.
03:18
<&McMartin>
It will potentially do a full traversal to compute to-remove, but it *has* to.
03:19
<&ToxicFrog>
(and filter, of course, returns a new seq with the filter applied, leaving the original seq as is, etc)
03:19
<&McMartin>
(Right. I was thinking of seqs as being something more like generic Iterables and thus potentially eagerly computed.)
03:19
<&ToxicFrog>
It won't have to, in fact! It only needs to do the first N that are from-me?
03:20
<&McMartin>
Right, but what if the Nth is the last one
03:20
<&ToxicFrog>
Then, and only then, will it realize the entire seq
03:20
<&ToxicFrog>
But like, if N=2 and the first two match, it only realizes the first two elements
03:20
<&McMartin>
Right. It's just "to-remove" *does* end up eagerly evaluated, is all.
03:21
<&ToxicFrog>
Yeah, by defining to-remove only requires evaluating enough seq elements to satisfy the call to take, not the entire seq.
03:21
<&ToxicFrog>
(not necessarily the entire seq, rather)
03:23
<&McMartin>
Right
03:23
<&McMartin>
It's been a long time since I've done any Clojure, I don't have which bits are eager and which bits lazy swapped in
03:24
< Mahal>
(sidebar: I am either really good at powershell or I've forgotten something. This script worked properly first time, so I don't trust it.)
03:25
<&ToxicFrog>
I don't remember them all offhand, but most of the "seq in, seq out" functions return lazy seqs
03:26
<&ToxicFrog>
And even the ones that don't are generally zero-copy (or at least, the copy only the pointers, not the whole data structure) because immutability.
03:26
<&McMartin>
Yeah. I have much longer experience with Scheme, Python, and ML, where such things generally copy the prefix and then share the suffix.
03:27
<&McMartin>
(Though I guess Python it would act like Clojure nowadays because you'd use generators)
03:29
<&McMartin>
Python ultimately *consumes* its generators though so you don't get the repeatability there you get from Clojure
03:32 Degi_ [Degi@Nightstar-s8e23t.pool.telefonica.de] has joined #code
03:34 Degi [Degi@Nightstar-vtah9h.pool.telefonica.de] has quit [Ping timeout: 121 seconds]
03:34 Degi_ is now known as Degi
03:43
<&ToxicFrog>
Mahal: that's how I feel about anything that works the first time no matter how comfortable I am in the language
03:43
<&ToxicFrog>
There's always a bug, so if it works on the first go the bug must be something really subtle and nasty!
03:43
< Mahal>
https://cloud.netlifyusercontent.com/assets/344dbf88-fdf9-42bb-adb4-46f01eedd629/ddfa7889-c131-4a6b-9773-883b2fd2fb02/03-programming-humor-opt.jpg
03:50
<&McMartin>
I'm now at the point of my career where I have a sense for a change of a certain size where it's actually OK if the tests pass the first time.
03:51
<&McMartin>
(e.g., I'm doing a simple graphical renderer right now. The hard part was getting a single triangle to appear on the screen. Once that part works, the distance from there to "a bunch of rectangles bounce around the screen" is short enough that it's plausibly might-work-first-try.)
03:55
<&McMartin>
... though I guess that one also passes the "single screen of 80s-style BASIC code" test
04:50 himi [sjjf@Nightstar-v37cpe.internode.on.net] has quit [Ping timeout: 121 seconds]
04:51 Kindamoody is now known as Kindamoody|afk
04:51 himi [sjjf@Nightstar-v37cpe.internode.on.net] has joined #code
04:51 mode/#code [+o himi] by ChanServ
05:53 abudhabi_ [abudhabi@Nightstar-1cji25.adsl.tpnet.pl] has joined #code
05:54 abudhabi__ [abudhabi@Nightstar-ftopsj.adsl.tpnet.pl] has quit [Ping timeout: 121 seconds]
07:18 Vornicus [Vorn@ServerAdministrator.Nightstar.Net] has joined #code
07:18 mode/#code [+qo Vornicus Vornicus] by ChanServ
07:20 catalyst [catalyst@Nightstar-np9mhl.dab.02.net] has joined #code
07:22 catalyst_ [catalyst@Nightstar-ejd4sd.cable.virginm.net] has quit [Ping timeout: 121 seconds]
07:22 catalyst_ [catalyst@Nightstar-ejd4sd.cable.virginm.net] has joined #code
07:24 catalyst [catalyst@Nightstar-np9mhl.dab.02.net] has quit [Ping timeout: 121 seconds]
08:16 himi [sjjf@Nightstar-v37cpe.internode.on.net] has quit [Ping timeout: 121 seconds]
08:24 himi [sjjf@Nightstar-v37cpe.internode.on.net] has joined #code
08:24 mode/#code [+o himi] by ChanServ
10:05 catalyst [catalyst@Nightstar-ejd4sd.cable.virginm.net] has joined #code
10:05 catalyst_ [catalyst@Nightstar-ejd4sd.cable.virginm.net] has quit [Connection reset by peer]
10:08
<@sshine>
does anyone here experience having to share confidential stuff between your co-workers and having to compromise protocol by emailing API keys or dumping them in some Slack message?
10:09
<@sshine>
we have compliance rules that everyone is breaking because we just don't have an internal end-to-end-encrypted expiring dropbox of sorts.
10:09
<@sshine>
e.g. when a developer hands over keys that operations are supposed to put in somewhere.
10:28
< [R]>
GPG is your friend
11:10
<~Vornicus>
uch. need a real hashtable in lua. :(
12:03 * TheWatcher runs a zendto for such things
13:58
<@sshine>
[R], GPG is on my list of candidates. sending a GPG email doesn't expire my attachment.
13:59
<@sshine>
[R], also, asking people in my company to use GPG is already futile. it's supposed to be about as easy as copy-pasting something into Slack.
14:01
<@sshine>
TheWatcher, sounds like what I want. :) it even does OAuth, which is sort of a requirement (so that you can't anonymously post something confidential, the recipient has to be tied within the company's 2FA.)
14:28 catalyst [catalyst@Nightstar-ejd4sd.cable.virginm.net] has quit [Connection closed]
14:30 catalyst [catalyst@Nightstar-ejd4sd.cable.virginm.net] has joined #code
16:50 Emmy [Emmy@Nightstar-l49opt.fixed.kpn.net] has joined #code
16:57 abudhabi_ [abudhabi@Nightstar-1cji25.adsl.tpnet.pl] has quit [Ping timeout: 121 seconds]
17:07 abudhabi_ [abudhabi@Nightstar-1cji25.adsl.tpnet.pl] has joined #code
17:32 catalyst [catalyst@Nightstar-ejd4sd.cable.virginm.net] has quit [Connection closed]
17:32 catalyst_ [catalyst@Nightstar-ejd4sd.cable.virginm.net] has joined #code
17:36 catalyst_ [catalyst@Nightstar-ejd4sd.cable.virginm.net] has quit [Ping timeout: 121 seconds]
17:37 catalyst [catalyst@Nightstar-bq1l3m.dab.02.net] has joined #code
17:38 catalyst_ [catalyst@Nightstar-ejd4sd.cable.virginm.net] has joined #code
17:38
<&ToxicFrog>
Vornicus: what do you need it for that the builtin table type doesn't provide?
17:38
<~Vornicus>
value-based comparison
17:40
<&ToxicFrog>
Aah
17:41 catalyst [catalyst@Nightstar-bq1l3m.dab.02.net] has quit [Connection closed]
17:44
<~Vornicus>
or to be more precise: I need to be able to put tables in as keys and use something other than object identity to tell whether things are identical or not. I am perfectly cool with providing my own hash function but I need to be able to go "this object is a key, and it looks like this other object" and that is not a thing the built in table type can do
18:05 Kindamoody|afk is now known as Kindamoody
18:26
<&ToxicFrog>
Yeah, that's something you can implement in lua but at minimum you're going to be faffing around with __index/__newindex to accomplish it
18:29
<~Vornicus>
yeah that's fine with me too, but I was hoping someone else had written it already
18:29
<~Vornicus>
and because there technically "is" a hashtable built in to lua's table implementation it's a little tricky to find
20:18 Netsplit Traal.Nightstar.Net <-> Krikkit.Nightstar.Net quits: catalyst_, Alek, @McMartin, @ToxicFrog, macdjord, @Tamber, Degi, [R], Emmy, @PinkFreud, (+4 more, use /NETSPLIT to show all of them)
20:18 Netsplit over, joins: [R], &jerith, Degi, Alek, macdjord, @himi, @gnolam
20:19 Netsplit over, joins: catalyst_, &ToxicFrog, @Tamber, Emmy, &McMartin
20:22 Syloq [Syloq@NetworkAdministrator.Nightstar.Net] has joined #code
20:44 PinkFreud [WhyNot@NetworkAdministrator.Nightstar.Net] has joined #code
20:44 ServerMode/#code [+o PinkFreud] by *.Nightstar.Net
20:44 mode/#code [+o Syloq] by ChanServ
20:44 mode/#code [+o ErikMesoy] by ChanServ
21:31 JustBob [justbob@Nightstar.Customer.Dissatisfaction.Administrator] has quit [Ping timeout: 121 seconds]
21:32 JustBob [justbob@ServerAdministrator.Nightstar.Net] has joined #code
21:32 mode/#code [+o JustBob] by ChanServ
21:37 catalyst_ [catalyst@Nightstar-ejd4sd.cable.virginm.net] has quit [The TLS connection was non-properly terminated.]
21:43 JustLurk [justbob@ServerAdministrator.Nightstar.Net] has joined #code
21:43 JustBob [justbob@Nightstar.Customer.Dissatisfaction.Administrator] has quit [NickServ (RECOVER command used by JustLurk)]
21:43 JustLurk is now known as JustBob
21:43 mode/#code [+o JustBob] by ChanServ
21:44 Kindamoody is now known as Kindamoody[zZz]
22:02 Emmy [Emmy@Nightstar-l49opt.fixed.kpn.net] has quit [Ping timeout: 121 seconds]
--- Log closed Fri Oct 22 00:00:02 2021
code logs -> 2021 -> Thu, 21 Oct 2021< code.20211020.log - code.20211022.log >

[ Latest log file ]