HNHacker News
TopNewBestAskShowJobs

eliben

3,222 karma · joined July 5, 2010

http://eli.thegreenplace.net
submissionscomments
eliben··on The Y Combinator in Go with generics
You're right, these posts assume one knows what the Y combinator is for. Wikipedia has a decent explanation: https://en.wikipedia.org/wiki/Fixed-point_combinator

Key point:

    the Y combinator implements simple recursion. In the lambda calculus it is not possible to refer to the definition of a function in a function body. Recursion may only be achieved by passing in a function as a parameter. The Y combinator demonstrates this style of programming. 
You don't really need it in modern programming languages that natively support named functions and recursion, but it's an interesting part of the underlying theory of lambda calculus.
eliben··on Faster Sorting with Go Generics
That's a good point, thank you for bringing it up. Finding the right examples is really tricky. sort.Search is binary search and hence a bit tricky to benchmark properly because of how ridiculously fast it is. Only a handful of comparison calls are made even for huge slices.
eliben··on Faster Sorting with Go Generics
The change mentioned at the top of the post (https://go-review.googlesource.com/c/exp/+/378134) also has a benchmark to compare sorting structs using sort.Slice vs a new generic approach that uses a comparison function:

    name           old time/op  new time/op  delta
    SortStructs-8  18.6ms ± 2%  15.9ms ± 3%  -14.43%  (p=0.000 n=10+10)
14.4% is the speedup of the generic version.

The article explains why this happens (towards the end).

eliben··on Faster Sorting with Go Generics
The FAQ has some good information: https://go.dev/doc/faq#generics_comparison and other sections around it
eliben··on Generics can make your Go code slower
Some of the issues pointed out by this (very good) article may already be fixed in tip Go, with https://go-review.googlesource.com/c/go/+/385274
eliben··on Rust extension traits, greppability and IDEs
Thank you for the thoughtful comment.

I'm actually aware of cargo doc - it's really useful, indeed. It's still note quite "greppability" though; I can open `cargo doc`. I can just open the browser and google "rust write_u16" and immediately find it. I can keep VS Code open with my project and search for it there. But neither of these is greppability :)

eliben··on Rust extension traits, greppability and IDEs
No kidding :) This post is now #3 on google for "greppability"
eliben··on Rust extension traits, greppability and IDEs
Thanks for the comment! I actually forgot to run clippy on these samples because they're so small; I'll fix up the code in the post to be more idiomatic.
eliben··on Ask HN: Where are you going to find long-form content online these days?
A lot of my reading is audiobooks. I love audiobooks - they enabled my reading levels to go way up in the last few years. Some more details about this here: https://eli.thegreenplace.net/2020/my-reading-habits/
eliben··on Ask HN: Where are you going to find long-form content online these days?
Fair question.

I spend some time researching books before I read them; very low signal-to-noise books typically will have reviews saying that. I also mostly avoid whole categories of books which are prone to this; I still get bitten once in a while, but like in one book out of 20 maybe, so overall it's not bad.

eliben··on Ask HN: Where are you going to find long-form content online these days?
Books

Seriously. Books are the ultimate long-form content; their authors typically spend years researching and writing them, and you can sample many reviews before committing to read one.

eliben··on Data seems to indicate omicron milder, more transmissible, hospitalizations low
What confuses me about these reports is that the relevant South African districts report ~25% vaccination rates; so it sounds unlikely that the mildness observed is due to previous immunity. Or is the assumption that most of these people have had COVID before?
eliben··on Tell HN: Lost then regained access to Google account, with correct credentials
You can pay for gmail too, and get phone/chat/email support via https://one.google.com/about/plans (basic plan is less than $2/month)

Doesn't this work for folks?

eliben··on Rust data structures with circular references
Thanks, you're making a good point. I like how you phrased the problem here, will ponder about updating the wording of the post slightly to reflect that.
eliben··on Rust data structures with circular references
`Rc` implies ownership, albeit shared one. So if a heap location is held by `Rc`, all reference to it should be either `Rc` or `Weak`. You can't have an `Rc` and a `Box` for the same data, IIUC. A `Box` is unaware of `Rc` and will drop its data when dropped itself.
eliben··on Rust data structures with circular references
Thanks for the pointer!

My goal in the post was to avoid "just use this crate" approaches, because clearly there are dozens of crates that could help with this... even crates that implement BSTs :-) The goal was to look at the underlying implementation of such crates, and as the other comment pointed out it seemed like slotmap and others used approaches that mapped to one of the three I outlined in the post.

eliben··on Rust data structures with circular references
I had this approach in a draft as well! In fact, I tried this before making all links `*mut Node`. But coding the removal methods turned out to be really hard - I couldn't fight through the borrow checker. So I figured if I already have raw pointers and unsafe blocks, might as well go all the way :)
eliben··on The hottest temperature ever reliably measured recorded in Death Valley today
What does "reliably measured" mean? Isn't the record 134F, measured in 1913? I wonder what the backstory here is.
eliben··on Submerged Italian Village Resurfaces After 70 Years Underwater
Interestingly, NZ has been settled by Polynesians only around 1300 or so (I think the latest estimates vary by +/- a few decades)
eliben··on Submerged Italian Village Resurfaces After 70 Years Underwater
1300 CE seems insane? The Middle East is like hold my hummus (https://www.timesofisrael.com/archaeological-dig-uncovers-10... etc.)
eliben··on Was cancer less likely in a pre-industrial world?
Yes, age and life expectancy is a huge part of it. In the book "Rebel Cell: Cancer, Evolution, and the New Science of Life's Oldest Betrayal", Kat Arney touches upon this exact question and reaches the conclusion that cancer was as prevalent in ancient times as it is now (perhaps accounting for surges like smoking-related cancers), and also mentions age as a big factor in the archaeological discrepancy.
eliben··on Go HTTPS Servers with TLS
Thank you for the comment! I will revise that part of the post to avoid confusion.
eliben··on Goroutines are not significantly lighter than threads
Some measurements of context switching: https://eli.thegreenplace.net/2018/measuring-context-switchi...
eliben··on Life of an HTTP request in a Go server (2017)
Thank you very much!
eliben··on Life of an HTTP request in a Go server (2017)
Thanks for posting this :)

Not sure why the (2017) tag though, this post is from yesterday!

eliben··on Male balding is a major risk factor for severe Covid-19
https://xkcd.com/925/ comes to mind
eliben··on Show HN: Hush Docs – private Google Docs alternative that works without internet
Is it only me, or is this website hijacking the back button?
eliben··on Disqus, a dark commenting system
Turned off Disqus on my blog a couple of years ago (https://eli.thegreenplace.net/2018/turning-off-blog-comments...) and have been generally happy since then.
eliben··on REST Servers in Go: Part 1 – standard library
Thank you for the detailed comment!

Just want to address (1) quickly. As you've mentioned at the end of the parenthesized note, the reason I did not use `defer` here is to avoid the lock staying across the rest of the handler. I wanted to confine it to the datastore interaction.

Thinking more about this now and having read the comments, I'm considering to just hide the lock in TaskStore and avoid all these explicit locks/unlocks in handlers; it seems like it will avoid some confusion for folks reading the example (as well as quite a few lines of code!), and my goal here is really the HTTP server logic. I prefer to deflect any attention from TaskStore in this series of posts.

eliben··on What is protein folding? A brief explanation
Could someone ELI5 why proteins fold in a unique way? Why can't there be multiple "valid" ways for them to fold (ignoring mirror symmetries)?
← PreviousPage 4 of 34Next →