For example, look at how Benjamin Qi does it: https://codeforces.com/contest/1446/submission/98447974
The actual code is at the bottom. Here is a sample of a submission to a problem harder than your usual AoC second part:
int main() {
setIO(); re(N,M);
str A,B; re(A,B);
F0R(i,N+2) F0R(j,M+2) mx[i][j] = -MOD;
int ans = 0;
R0F(i,N) R0F(j,M) {
ckmax(mx[i][j],mx[i+1][j]);
ckmax(mx[i][j],mx[i][j+1]);
if (A[i] == B[j]) {
dp[i][j] = 2;
ckmax(dp[i][j],mx[i+1][j+1]+4+i+j);
ckmax(mx[i][j],dp[i][j]-i-j);
ckmax(ans,dp[i][j]);
}
}
ps(ans);
}Beta-testing it with some friends and family now; we'll see if it grows into anything real!
I know, how something _sounds_ is subjective but I was thinking something along the lines of how Shazam app does. If they can compute a song signature and compare it against a library, it should be possible(?) to find top 10 closest neighbors.
BTW, I'd love to test your app if that's possible.
Like LightTable? Might want to check that out if you're not already aware of it. I don't know if it's gone anywhere in recent years or has inspired any similar features in other editors.
The idea was to have a compiler for pseudocode used in CS books in place of real code.
There are a few small differences (eg. using = vs :=) but most books and interview-preparing materials use a C-like notation.
Then I started reading papers written by language researchers (which use haskell-like pseudocode) and realised the size of the task at hand.
Probably trying to please only CS students / people doing interviews would still make for a fun hack.
That way you always have access to the Python libraries, for competitions where you need to show your code it'll be easier, and there are already a lot of optimisations.
That said if you're primarily doing this for fun- go wild with the implementation.
> As far as I'm aware, there aren't any existing languages in this space.
In some form or another, all existing languages (other than joke langs) are in this space. That’s why we have programming languages. Ultimately they all prioritize some subset of “problems” that they optimize solving.
That said, in terms of instant feedback I’d look at LightTable and (believe it or not) Chrome dev tools as prior art.
I was hoping there was going to be some insightful critique after that long preamble. This is similar to an "all languages are Turing complete" type nitpick that doesn't add much to the conversation.
I tried solving AOC2020 as a means for learning golang. 6 challenges in, I gave up not because the challenges were hard but because it took longer to translate logic to code. It was no fun to write simple for loops, before getting into actual problem logic. Having to write a minInt function is like a distraction when you want to be focusing on the programming challenge. It is much simpler to use a programming language like Python that comes batteries included.
In this regard, I suppose functional programming can be quite expressive. If you can break the problem into functional units, it can be a pleasure to solve programming challenges using FP.
Sure...but not solving quickly, at the expense of all else. Rust is optimized for solving certain problems -- but solving them robustly, not quickly. Python comes a bit closer, but Python also wants to be readable; I don't have to worry about that.
I guess one way to frame it is: the core values (https://vimeo.com/230142234) of this language are velocity, and...that's it. Maybe expressiveness (less typing) and transparency (immediate feedback), but really those are just aids to velocity moreso than orthogonal values.
I really, sincerely, think they do. It’s just that their optimizations focus on the subset of problems. For example:
> Rust is optimized for solving certain problems -- but solving them robustly, not quickly.
This is basically the same thing as saying: when the problem one wants to solve quickly is robustness, Rust may be a good choice.
> Python comes a bit closer, but Python also wants to be readable; I don't have to worry about that.
There are some problems I associate with quickly solving in Python, and others where I find it exceptionally slow. Sure, readability may be a contributing factor. Another is immature/complex tooling that makes static validation or dependency management a slog. Another still is that a lot of its concurrency story is in flux and you have to spend time researching approach and compatibility if your problems are concurrency related.
I’m still not trying to discourage, but I’ve spent most of my career working in scripting languages (those which most prioritize “rapid prototyping” and “repl driven development”), and ultimately when they’re applied to use cases that they’re not designed for their velocity is consumed by tooling.
My advice, intended with kindness and encouragement, is to consider which problems you wish your language to be able to solve rapidly.
To your points about velocity aids, expressiveness and transparency aren’t just velocity amplifiers at the time you write code. They also (can) aid velocity of reading comprehension, editing/refactoring, review. This is a place where Python does very well in terms of velocity: even when I had read less than 100 lines of it, I could generally review work and ask important questions about what it was doing in... well, frankly a shorter time than the JS I was actively working with as a lead at the time.
It’s clear you want a language that enables devs to dev fast. But what are they doing fast?
Solving programming challenges. Maybe this sounds broader than I intended. By "programming challenges" I literally mean Advent of Code, HackerRank, etc. This is by no means a general-purpose language!
I guess in your terms, the "problem one wants to solve quickly" is "outputting the answer that will be accepted as correct by the programming challenge website."
Or, how about vocal programming? I wonder if, in practice, dictation might be faster than typing? :)
That is, I'm not optimizing for execution time, I'm optimizing for time between reading the problem statement and having a working solution. As far as I'm aware, there aren't any existing languages in this space. There are plenty of "code golf" languages, which optimize for shortest finished program, but that's slightly different. Based on the top AoC solvers, the closest thing today is Python -- but we can do so much better!
Currently, the language is very immature, but it can solve a handful of AoC problems. But before long, I'll need to tackle a very big problem: building an IDE around this thing. See, for a language like this, the syntax is only half the battle. Ideally, when I type something like `| map (*2)`, I should have instant visual feedback showing me how the input is affected by this change. Not to mention more traditional IDE features, like suggesting functions based on the type under the cursor.
I don't have anything public to share yet, but if you're interested in collaborating (esp. on the IDE), feel free to shoot me an email.