3 ms·
Ask HN: What's the most elegant piece of code you've seen?
old - https://news.ycombinator.com/item?id=11005003
Been a while since this was asked. What has captured your attention for its elegance and beauty
- derwiki 4y agoA little dated, but tornado always impressed me: https://github.com/tornadoweb/tornado https://github.com/tornadoweb/tornado Also Norvig’s spell checker: https://norvig.com/spell-correct.html https://norvig.com/spell-correct.html
- deterministic 4y agoThe Lambda Calculus. Invented in the 1930s it is still used today as the basis for most advanced CS research and as the foundation of many programming languages.
- Dopameaner 4y agoI am surprised no one mentioned chatGPT or GPT-3
- Dopameaner 4y agoSome of my fav. works include Bittorrent and Bitcoin
- bitlax 4y agoRedis source often gets mentioned in these threads.
- betsuin 4y agocat /var/log/apache2/access.log | awk '!a[$0]++'
- _-----_ 4y agoAnything I have ever written, until I've re-read it.
- jeffrallen 4y agoA wonderfully Go-like piece of magic: https://github.com/golang/go/blob/go1/src/pkg/image/gif/reader.go#L180 https://github.com/golang/go/blob/go1/src/pkg/image/gif/read... What's magic there seemed magical at the time because even Go's creators were only just coming to see the power of interfaces then. Now, having a decompressor read from a block reader, which reads in turn from some other place, is not magical, it's just good practice. This is from Go 1. Unfortunately, that file accumulated tons of other ugliness over time, as it dealt with the real world. I was one of the people who had to make that line less magic. Sorry Rob.