3 ms·
Wanted to state the main idea first. I definitely agree about one-liners, Perl and APL come to mind. There are some other aspects to this idea of code economy:
by Apaec 8y ago
Wanted to state the main idea first. I definitely agree about one-liners, Perl and APL come to mind.
There are some other aspects to this idea of code economy: correctness and reusability. This definitely depends on the programming language.
In Java(or oop for that matter) you can get correctness but to get reusability you need a whole hierarchy of classes, lots of added code/cost.
In Python you get more reusability out of the box but to get correctness you need to add swaths of unit tests, lots of cost.
In contrast with a functional language such as Haskell you get both with less effort, fp plus a rich type system reduce code enourmosly.
- aldanor 8y agoSame with Rust, to some extent -- in some cases it's extremely hard to get a program to compile, fighting with borrow checker along the way, but when it's done and done you can be fairly sure it won't segfault due to a dangling pointer or something stupid of the sort. It also makes it easier for you to trust the code written by others, e.g. when working on a large codebase collaboratively.
- Apaec 8y agoRust is another favorite of mine, and with Rust you also get efficiency besides correctness and reusability. I wish Rust would have gone with an ML syntax though, in particular the Hindley-Milner type signatures allow me to reason better about code reusability, the "fn" and braces just adds noise to me, too much Haskell I guess.