Introduction

Whilst designing my functional programming language Lam, I wondered about applications - how can I annotate this application in such a weird way but it still works as intended?

If you don’t know anything about what I just said, just know an application is just a function call e.g. (+ 1 2) => 3.

This was a good thought experiment for me, because I ended up accidentally creating a positional notation system for numbers based on their relationships in the natural number line. That was a mouthful.

Okay back to what I was saying, let’s say I had the application (+ 1 2), this is literally just one plus two. Simple. I then thought to myself: “How could I make this look extremely confusing but still produce the result I expected?”. I came to the conclusion of using symbols, not random symbols - but symbols with semantic meaning.

So I decided to remove 1 2, and replace it with this: (+ 1^). Eh, I still have a number, but my intention is clear when I explain myself: 1^ is just one and the next number greater than one, in this case it’s two. At first glance, the ^ symbol looks a bit ambiguous sitting next to 1, it looks like I’m trying to raise one to a power, or XOR it.

To clear up any confusion, I decided to add another symbol to denote that I’m expecting a number to the right side of one. That number will always be greater than one, so I guess I could drop the ^. So now I have (+ 1>), okay now it looks like I’m going to check if it’s greater than another number.

I decided numbers are going to make it ambiguous, so I decided to drop numbers and instead introduce another symbol, <. Like > I can use < to represent lesser values, but lesser than what?? Right, nothing, so thinking about it mathematically; < could denote the start of a natural number list, where > can represent the end of a natural number list, in this case it would be infinite. So I don’t think a computer could do that efficiently, and I would suggest an implementation of this notation could lazily create a natural number list.

What do I need to fix this? - constraints. This will allow me to constrain the natural number list to a specific set of numbers, let me introduce a new symbol, .. I suppose this could be used as a step or distance notation from the start of the list? Okay so now we have this: (+ <^.>), this is saying:

From the start of the natural number list, ensure it is positive, and from one position from the start, that will be the end

This would translate to (+ 0 1). Not what I wanted. Maybe I could introduce another symbol to notate positive and non-zero. Good. Hello % (I’m just picking random symbols now lol), this will mean positive and non-zero, yes. So now we can represent: (+ 1 2) as (+ <%.>).

Conclusion

This was just a random thought I had, and I think it’s cool to share such complex things I think about. One thing I’ve gathered from this is that notation is arbitrary - all that matters is the rules which give the symbols meaning. < isn’t the start of a natural number list until I say it is.

I believe that I could create a very complex notation system, but produce incredible results with little typing needed, all you need to understand is the rules behind symbols; and how to pipe them into something.