Hacker News new | ask | show | jobs
by zelah 3021 days ago
My favorite programming language is Zero (yes it is my invention). If you have not heard of it then I am not surprised because the language is very new (theoretical actually). You develop programs in it by defining new infinite sequences from existing ones.

All begins with the primitive infinite sequences and the language's means of combination (specified with decimal digits)

---universe begin---

sequence 01: 0 1 2 3 4 5 ...

sequence 03: 1 2 3 4 5 6 ...

sequence 05: 2 3 4 5 6 7 ...

sequence 07: 3 4 5 6 7 8 ...

...

---universe end---

0105: count by two

---universe begin---

sequence 01: 0 1 2 3 4 5 ...

sequence 02: 0 2 4 6 8 10...

sequence 03: 1 2 3 4 5 6 ...

sequence 05: 2 3 4 5 6 7 ...

sequence 06: 1 3 5 7 9 11 ...

sequence 07: 3 4 5 6 7 8 ...

...

---universe end---

01030501: set up some cycles

---universe begin---

sequence 01: 0 1 2 3 4 5 ...

sequence 02: 0 2 4 6 8 10...

sequence 03: 1 2 3 4 5 6 ...

sequence 04: 0 1 2 0 1 2 ...

sequence 05: 2 3 4 5 6 7 ...

sequence 06: 1 3 5 7 9 11 ...

sequence 07: 3 4 5 6 7 8 ...

...

---universe end---

Please note that as the universe grows we always leave space for more sequences by skipping every other sequence designation.

What makes this language useful is that with very little effort any two arbitrary infinite sequences can be defined. As a consequence any mathematical relation is easily defined as a mapping from members of one sequence to the corresponding members of the other sequence.

I will briefly describe the language's means of combination. Writing a sequence designation one next to another will form new sequences by pulling out corresponding members. But all sequences are infinite so after the last designated sequence is visited the member value is used to select the possibly new member in the first designated sequence. Digits that are not able to be confused with sequence designations specify the three other primary means of combination. They are "cons", "car", "cdr". With a proper understanding of their use one can build arbitrary sequences. I will just say that "cons", "car", and "cdr" are used to combine entire sequences which is logically equivalent to combining corresponding members of those sequences.

In the code above I write "0105". The "01" is a sequence designation. The "05" is a sequence designation.

1 comments

How do you define new sequences? What is the 'purpose' of this language -- that is, what can I do with it?
Thank you for asking.

I define an infinite number of new sequences twice over in the example above. Between "---universe begin---" and "---universe end---" is listed the state of the universe. After inspecting the current state of the universe one can add new sequences with numeric codes as I have attempted to describe. The example above shows two iterations of this process. In each case an infinite number of sequences is added. So really your program will describe an infinite sequence of infinite sequences. And, if you never stop programming, then you are actively directing an infinite sequence of infinite sequences of infinite sequences!

The purpose of the language is to be "general purpose". Any programming problem can be modeled with this language. Because a number represents anything at all, I would not hesitate to use the language anywhere I have need for an algorithm. Input transformed to number is manipulated by algorithm then presented to the user as output. A gui is typically used to control this process.

Impressively, it is possible to write relations with very little knowledge of specific algorithms. For instance, you may know how to square a number but be totally ignorant of methods to find the inverse function (the square root). Not a problem - you already know enough to direct the computer to take square roots. This might seem magical. It certainly is magnificent, but there is no magic involved. It all has to do with the design of the language.

Do you have a link to it?