I was curious to find out the answer count for each of the languages I golf in.

Using the Stack Exchange Data Explorer, I just wrote a query to answer just that and thought other people might find it interesting.

Here are my languages. Query with your user id to find out yours.

While we're at it, here's a list of all the languages on the site.

The queries are not perfect, and they rely on the answer body to be of the form: <h?>{LanguageName}?, where:

  • the first ? can be 1, 2, or 3
  • the second ? can be space, colon, comma, or <

(after some trial and error I noticed these values work in most of the cases)

Suggestions for improving the queries are welcome.

Edit: Removed the answers to King-of-the-hill questions (improvement suggested by steveverrill)

I also merged the two queries into one, which allows filtering by a user id, or specifying null to see all stats.

Edit: Improved the query by implementing ProgramFOX's suggestion (parse language names when wrapped in <a> tags): http://data.stackexchange.com/codegolf/revision/308877/400000/code-golf-languages

Edit: Added "Total Score" column (sum of upvotes): http://data.stackexchange.com/codegolf/revision/308882/400005/code-golf-languages


3 Answers 3


+1, Very interesting data, unfortunately reliant on how people present their answers.

At the bottom end of the table you can see a lot of KOTH answers with the names of bots being misinterpreted as languages.

But the greatest issue is that Brainfuck is all over the place! There are seperate entries for Brainf**k and Brainf*** for example. Searchability is a great reason to stop censoring the name of this language!

Ordering by language also reveals the great variety of ways that C and its derivatives are presented. there are over 20 entries, and I'm surprised we have less C++ than C# I wonder if that's correct? Still, good work!

  • 1
    \$\begingroup\$ Less C++ than C# is probably correct. I've seen a lot of answers with Linq, but very few using STL. \$\endgroup\$ Commented Apr 15, 2015 at 13:32
  • \$\begingroup\$ Good point - perhaps I should filter out answers to KOTH questions. \$\endgroup\$ Commented Apr 15, 2015 at 13:32

Some of my answers have links in the header, pointing to a wiki page about the used language. It would be nice if these answers are counted as well.

  • \$\begingroup\$ I'll think of this. Unfortunately, SQL Server does not support Regex and text manipulations such as these can be pretty hard. \$\endgroup\$ Commented Apr 15, 2015 at 13:30
  • \$\begingroup\$ I managed to parse the language names in links. Here's the improved list showing your languages: data.stackexchange.com/codegolf/revision/308877/400000/… \$\endgroup\$ Commented Apr 30, 2015 at 19:33
  • \$\begingroup\$ @w0lf Nice! Adding a [status-completed] tag to my answer. \$\endgroup\$
    – ProgramFOX
    Commented May 1, 2015 at 6:19

I like the idea. I also have some answers that don't have a language for the header (like for a tips page or something) so these can be omitted, in my opinion. Also, some challenges such as KOTH for a specific language have the header as a bot name, instead of a language. These could be fixed by checking posts for a prettify tag declaration that can override a header, since I use prettify tags in my code.

Regex to match a prettify tag: <!--(?:\w)*language(-all)?(?:\w)*:(?:\w)*lang-(.*?)(?:\w)*--> The first capturing group indicates whether the tag is for the entire post or the next snippet. The second capturing group is the language name or abbreviation (e.g. js for JavaScript or cpp for C++).

Example tag usage: <!-- language: lang-python -->

  • \$\begingroup\$ Unfortunately, T-SQL (which is the language I used for the query) does not support regex. That's why I resorted to the ugly workarounds you see in my query. With regex, it would have been much easier. \$\endgroup\$ Commented Jun 5, 2015 at 6:28
  • \$\begingroup\$ @w0lf Ah. It does have some regex pattern matching functionality though. See here and here. Not sure how useful that would be in this case though, since there are no capture groups. \$\endgroup\$
    – mbomb007
    Commented Jun 5, 2015 at 15:43
  • \$\begingroup\$ Exactly. The CLR solution is the only one with a rich enough functionality, but it involves running some custom DLLs on the server side, which is not allowed in this case for obvious security reasons. \$\endgroup\$ Commented Jun 6, 2015 at 5:58

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .