Ask HN: Most Succinct Programming Language
Hi HN,
I have some free time and wanted to learn a new language.
I was interested in off beat, not as popular as well as mainstream languages which focus on lines of code reduction as one of their key features.
What would be your recommendations?
29 comments
[ 3.2 ms ] story [ 53.6 ms ] threadAlso, legibility is a crucially important aspect of complexity.
I can't exactly say I recommend it for practical use though, it's everything I think a language shouldn't be, but it sure does attract some devoted fans.
They are both very minimal in their syntax, for many purposes Forth uses a space where lisp uses parenthesis to ensure the arguments are consumed by the correct functions.
However.... you can't match spaces, which leads to losing track of arguments on the stack
I can think of ways this could be handled in an IDE, but my bet on Forth includes types, and operator overloading, a language called STOIC in the 1960s.
https://www.youtube.com/watch?v=a9xAKttWgP4
If you want something less popular, perhaps give Nim a try.
I'm really liking Nim as a hobby these days. It has a very powerful macro system, which might interest OP. Nim macros basically normal nim code, executed at compile time by an interpreter built-in the compiler, which can directly manipulate or generate Nim AST.
Macros aren't exactly easy to read or write (again, it consists of manipulating AST nodes directly), but they can generate any amount of boilerplate code you need.
Definitely see Paul Graham's essay "Beating the Averages" http://www.paulgraham.com/avg.html
People have tried to define and measure this and related ideas in different ways, and I'm not sold on any of them in particular. I can however suggest some languages that stand out in some of these explorations that you might consider.
+ Lisp dialects. In particular, take a look at Clojure, Shen, and Racket.
+ Smalltalk. Try Pharo. Check out some YouTube videos with Alan Kay.
This is also worth a read https://medium.com/smalltalk-talk/lisp-smalltalk-and-the-pow...
If you're interested in math and data science stuff, also check out Julia.
--
PLs from the APL family are probably most succint, then come Forth-like languages.
But most succint doesn't mean they're fastest to solve problems with, correct, or reable/easier to maintain.
When writing code in APL/J/K/Q you write one-liners in the REPL and iterate (refactor?) on them until you're getting the desired result. It might be that a little bit more verbose language will give you a solution faster, even if it will require a little bit more typing, but less iterations in the REPL.
The possibility of making a mistake or getting the wrong result is much higher for the APL family of languages.
The idiomatic style makes them almost write-only and hard to maintain.
TXR is a native program, with its own run-time, and has very low dependencies. There is a capable, expressive FFI.
Here is an example: ger2err: a complete, stand-alone program with command line parsing, which connects to Gerrit servers to extract changeset comments, turning them into compiler error format you can use in your IDE.
https://www.kylheku.com/cgit/ger2err/tree/ger2err
This is a good sample of what ordinary TXR Lisp looks like where effort hasn't been put into "golfing" the code.
Here is code for Advent of Code 2021, Day 8 (https://adventofcode.com/2021/day/8):
https://www.kylheku.com/cgit/advent/tree/2021/08