Which programming language is the most concise?

[This article was first published on Revolutions, and kindly contributed to R-bloggers]. (You can report issue about the content on this page here)
Want to share your content on R-bloggers? click here if you have a blog, or here if you don't.

An expressive programming language allows developers to implement algorithms quickly, by using high-level concepts and leaving the details to the language implementation. The result is clearer, more maintainable code that can be created in less time. (Although shorter code isn't always better, especially when taken to extremes.)

So which programming languages use the least code, when compared on an apples-to-apples basis? At the WolframAlpha blog, Jon McLoon analysed the same algorithms (from the Rosetta Code project) implemented in 14 different languages, and compared the program sizes. Jon used the metrics of lines of code, characters of code, and token count (which ignores varying length of procedure names) to measure program size. According to Jon, the fairest comparison is character count for non-trivial algorithms (“large tasks”), and the results are shown below:

RosettaCode-length-analysisThe shortest code on average is produced by programs written in Wolfram's Mathematica. The runner-up is Clojure, closely followed by the R language. For comparison, programs written in Python are more than twice the length of equivalent programs in R; programs in C++ are about 4x the length. Read the complete analysis at the link below.

Wolfram Blog: Code Length Measured in 14 Languages

To leave a comment for the author, please follow the link and comment on their blog: Revolutions.

R-bloggers.com offers daily e-mail updates about R news and tutorials about learning R and many other topics. Click here if you're looking to post or find an R/data-science job.
Want to share your content on R-bloggers? click here if you have a blog, or here if you don't.

Never miss an update!
Subscribe to R-bloggers to receive
e-mails with the latest R posts.
(You will not see this message again.)

Click here to close (This popup will not appear again)