Remote-first CEO of @Doist, the company behind @Todoist and @TwistAppTeam. Born in Bosnia, grew up in Denmark and now living in Barcelona. New dad.

Dec 8, 2015

How Hacker News ranking algorithm works

In this post I’ll try to explain how the Hacker News ranking algorithm works and how you can reuse it in your own applications. It’s a very simple ranking algorithm and works surprising well when you want to highlight hot or new stuff.

Digging into news.arc code

Hacker News is implemented in Arc, a Lisp dialect coded by Paul Graham. Hacker News is open source and the code can be found at arclanguage.org. Digging through the news.arc code you can find the ranking algorithm which looks like this:

; Votes divided by the age in hours to the gravityth power.; Would be interesting to scale gravity in a slider.