March & April 2024: Programming with Hieroglyphics

Bumble around stackoverflow for long enough, and you'll find evidence of programming languages that you've probably never seen before. That's where I first stumbled across Uiua, which caught my eye, because it looks like this:

To be fair, this looks worse than it is. Uiua runs on something akin to the latex engine, which converts operation calls to ASCII symbols. This is attractive to me in two ways, both of which appeal primarily to vanity:

1. It makes the lines short

2. Nobody will know at a glance what I'm doing

If their website is to be believed, it's also fairly powerful, because it's based on arrays, but in all seriousness, I probably won't really see the benefits of that, unless I'm going to work with other people on a large project.

Like always, these things are best learned by doing a project. I need a script to help tackle the last mile problem for a different thing I'm doing, so might as well do it in Uiua, to make the execution of said idea more obtuse once I actually get around to finishing it. However, this month was absolutely insane on my calendar.

Exhibit A: I had 1 day without an appointment in a month that was didn't have any lectures.

Beyond that, I had exams to prep for, so since this is a new way of thinking about programming (i.e. not object-oriented) and the problem I was thinking of tackling with this is very much non-trivial, this month will just be me working through the concepts and built-in functions.

What Else? Setup Troubles

In the previous month, I redid my tmux and vim configs. That should tell you how I like to program. This can be an issue for languages that aren't set up straight-forwardly. Uiua, then, requires some extra setup, because not only is the language weird, its compiler is also weird. I thought I knew enough stuff about vim to leave it as is for a while, but no, I needed to install a vim extension, and even though this is technically a very straight-forward thing, I never feel certain that something worked, if I don't get overwhelmingly positive feedback. I also just had an off-day and forgot that I had to re-source the vim config for it to adapt the changes, so I sunk an hour into something I likely won't have to do again for a while, and I haven't even written a single line of code. That is especially depressing, because the line of code I tested the installation against was this:

8

Stack-Based Array-Oriented

I don't have a computer-science background. I'm not sure this statement will remain true forever, but as of now, all these four words tell me, is that this is uncharted territory. Stack-oriented programming languages are usually a little older, where the order of operations is read as an array, usually from left to right. That means that 2-form methods will first require their parameters to be read into the stack, before the method is called. That leads to constructs like:

	1 2 +

outputting 3. Once a method has been called, the finalized instructions are discarded and replaced with their result. This approach opens up a can of new operators called "stack manipulation operators", stuff that moves entries in the stack up or down, or rather swapping them either way. This will be relevant for non-Abelian operations, such as division. It makes sense for Uiua then, to primarily use arrays as their variables, which naturally have a "stack-like" format.

Implementation will have to wait, because I'm not sure how I want the input data to look. Instead, let's quickly talk design:

Google maps has all the data we need, even if the software is kind of terrible, if you actually try to use it. I'm relying on the existence of an API to help me fetch routes and driving times, either of both of which will get me to the number I'm actually looking for. There's going to be a lot more search result hits than I'll know what to do with, so I'll need a filter, which will likely include the driving time first and foremost.

Obviously, we apply the filter first, cap the driving times to something about 30 minutes both ways, less, if there's going to be more than five or ten hits. Uiua could probably iterate over a vector of this data and give a ratio of effectiveness with respect to weight.

Calculation is easy. We go diesel one way, and Eco-Fuel the other, each will have some coefficient of CO2 produced by liter burned, calculate the weight fraction for attribution and get to a final result. The problem is really more figuring out how this language works, because it's not conducive with the way I think about programming things.

Previous
Previous

May 2024: The Phonetic Alphabet

Next
Next

February 2024: Futzing with Configs