I was looking at code.golf the other day and I wondered which languages were the least verbose, so I did a little data gathering.
I looked at 48 different languages that had completed 79 different code challenges on code.golf. I then gathered the results for each language and challenge. If a “golfer” had more than 1 submission to a challenge, I grabbed the most recent one. I then dropped the top 5% and bottom 5% to hopefully mitigate most outliers. Then came up with an average for each language, for each challenge. I then averaged the results across each language and that is what you see here.
For another perspective, I ranked each challenge then got the average ranking across all challenges. Below is the results of that.

Disclaimer: This is in no way scientific. It’s just for fun. If you know of a better way to sort these results please let me know.
On another look, though, we have to keep in mind, though that this is code-golf, so in no way representative for actual code-bases.
Haskell being so high really doesn’t make any sense. Experience level maybe?
It’s one of the tersest languages out there.
Bash being so high is what confuses me.
Damn near everything is an acronym
I’m really surprised to see Java ranked as less-verbose than OCaml.
Here’s an equivalent code sample in Java 17 vs OCaml:
Java:
abstract sealed class Expr permits Value, Add, Subtract, Multiply, Divide { abstract long eval(); } record Value(long value) extends Expr { @Override long eval() { return value; } } record Add(Expr left, Expr right) { @Override long eval() { return left.eval() + right.eval(); } } record Subtract(Expr left, Expr right) { @Override long eval() { return left.eval() - right.eval(); } } record Multiply(Expr left, Expr right) { @Override long eval() { return left.eval() * right.eval(); } } record Divide(Expr left, Expr right) { @Override long eval() { return left.eval() / right.eval(); } }OCaml:
type expr = | Value of int | Add of expr * expr | Subtract of expr * expr | Multiply of expr * expr | Divide of expr * expr let rec eval = function | Value value -> value | Add (left, right) -> (eval left) + (eval right) | Subtract (left, right) -> (eval left) - (eval right) | Multiply (left, right) -> (eval left) * (eval right) | Divide (left, right) -> (eval left) / (eval right)…Java has so much more syntactical overhead than OCaml, and that’s even with recent Java and being pretty aggressive about using boiler-plate reducing sugars like Records. And F# has even less, since it doesn’t require you to use different operators for numerics or do as much manual casting between strings/numerics
I’m surprised C is so low. I feel like I need to write 5x more code (compared to C++/Rust) to do the exact same thing.
You have not read enough code from IOCCC.
Why would golfscript be more verbose than some others? Isn’t it made for golfing?
Rest in pieces golfcels it’s pychad time
Would assembly be higher or lower than brainfuck?
Assembly would be lower. You have more complex / direct instructions in assembly. Brain fuck is pretty much just a pure turing machine, and has 8 instructions.
X86 has ~ 1000 + variants. Even ARM with a smaller instruction set has 232 instructions.
In brain fuck to set a number you’d have to count up (or down - underflow) to that number. In assembly you just set it.
Somewhere I’ve read that current assembly code with Makros should be similar to writing C.
Is Dart inherently verbose, or does it just seem that way because people are using it to make Flutter widgets and they’re verbose? When you look at the Dart syntax it doesn’t seem like it needs to be verbose, but Flutter code certainly can be.
This is from codegolf competitions, so non-Flutter I’d assume.
Idk, in my short experience with it, it feels very Java like in verbosity
Interesting that zig is so much lower than c in expressiveness. Isn’t that a bit weird?
With my professional experience in COBOL, I can honestly say I’m not surprised at all!
How come kotlin isn’t there
Apparently it due to an issue with Kotlin - https://github.com/code-golf/code-golf/issues/151#issuecomment-1126266250
I’m suprised by F# position
It’s interesting, the results here are way different than the Code Golf & Coding Challenges Stack Exchange. I would never expect Haskell to be that low. But after looking at code.golf, I realize it’s because I/O on CG&CC is more relaxed. Most Haskell submissions are functions which return the solution.
Sidenote: I like the CG&CC method, it’s semi-competitive, semi-cooperative.
- all languages welcome
- almost all users post “Try it Online”/“Attempt This Online” links
- most users post explanations under their submissions
- often people will post solutions beginning with “port of user1234’s excellent Foolang answer” when there’s a clever shortcut someone finds
- or people will post their own solution with “here’s a solution which doesn’t use user1234’s algorithm”
- or people will add comments to answers with minor improvements
IMO It’s geared towards what is the best part about code golf: teaching people about algorithm design and language design.
What, SQL is down the bottom?
Hmm interesting, I would’ve thought that Haskell would rank much higher
deleted by creator
we hated studying that shit
It’s a more than fine functional programming language if you ask me. Was that the functional aspect that you disliked? Or the syntax? Because in one case like the other I’ve got some bad news for you about what’s to come in the programming languages landscape :)
Who tf uses OCaml.
The rust compiler (initially), large financial companies, the energy sector, etc: practically anywhere functional programming shines
written by a Scala programmer










