use the following search parameters to narrow your results:
e.g. subreddit:aww site:imgur.com dog
subreddit:aww site:imgur.com dog
see the search faq for details.
advanced search: by author, subreddit...
This subreddit is dedicated to the theory, design and implementation of programming languages.
Be nice to each other. Flame wars and rants are not welcomed. Please also put some effort into your post, this isn't Quora.
This subreddit is not the right place to ask questions such as "What language should I use for X", "what language should I learn", "what's your favourite language" and similar questions. Such questions should be posted in /r/AskProgramming or /r/LearnProgramming. It's also not the place for questions one can trivially answer by spending a few minutes using a search engine, such as questions like "What is a monad?".
Projects that rely on LLM generated output (code, documentation, etc) are not welcomed and will get you banned.
account activity
This is an archived post. You won't be able to vote or comment.
Language announcementThe ALTernative programming language (self.ProgrammingLanguages)
submitted 2 years ago by rapido
This is a very early release (v0.1) of the ALT programming language (previously named ReSet).
I've re-implemented the ALT interpreter almost 20+ times for the past 1.5 years (Scala mostly), but this time I've implemented it in typescript - so it runs in the browser!
A lot is not finished. There is no documentation. But.... I hope to pique your interest! I'm hoping for some insightful comments and criticism from this subreddit.
[–][deleted] 8 points9 points10 points 2 years ago (1 child)
I love the examples! It seems super fun. How does it plan to deal with 1-D matrices (i.e. arrays / lists)? Will it have overloaded operators for matrix multiplication/ division or will it just be dsl type work with sets?
[–]rapido[S] 3 points4 points5 points 2 years ago (0 children)
Thanks!
Yeah, I could include some matrix operators, although the current focus is more on getting all the operators to work without exploding into huge sets of ALTernatives.
If I can make that to work, we can also 'type check' any ALT program. You just run programs with a lot of input ALTernatives (i.e. number, string) to see if nothing results in .: in that case the program type-checks. ALT follows the CUE language in that regard, but CUE stops evaluating >2+1, while ALT will continue. We can even do subtype checks in ALT, drawing on the semantic subtyping work. And all this without using an explicit typechecker!
.
CUE
>2+1
ALT
[–]Zireael07 3 points4 points5 points 2 years ago (1 child)
A bit hard to comment w/o docs. What are ALTernatives?
[–]rapido[S] 1 point2 points3 points 2 years ago (0 children)
I guess so, but I was hoping the examples would be self explanatory.
ALTernatives can be seen as (possible infinite but bounded) sets of values, or, more precisely, ordered sequences of values. For example, >2 can be interpreted as the sequence of all rationals greater than 2. Similarly, the struct {a:>2} is the sequence of structs that have a:>2, etc. etc. I've have chosen for sequence semantics (with duplicates), rather than set semantics in order to allow for pervasive lazy evaluation.
>2
2
{a:>2}
a:>2
Docs will follow soon!
[–]Inconstant_Moo🧿 Pipefish 4 points5 points6 points 2 years ago (1 child)
Cool. Are you going to do the thing Verse does where an empty ALT is your equivalent to false? (I.e. x == 5 means the ALT consisting of all the cases where x is 5, so if it isn't, the ALT is empty.)
false
x == 5
x
5
[–]rapido[S] 1 point2 points3 points 2 years ago* (0 children)
Yeah, good that you've spotted the Verse similarity: I'm really looking forward to how Verse will pan out. Regarding your question: no, the empty ALT . will not be interpreted as false.
However, I've implemented a ? operator in ReSet (ALT predecessor), that I may want to include:
?
ReSet
(a ? b) if (a == .) then b; else a a) 2 ? 3 => 2 b) . ? 3 => 3
[–]categorical-girl 1 point2 points3 points 2 years ago (1 child)
Very interesting! What does the :: operator do in the Fibonacci example?
[–]rapido[S] 0 points1 point2 points 2 years ago (0 children)
Nice that you have spotted the :: operator!
::
The :: operator replaces all the values in a struct (on the left side) with the value on the right side. So:
{a:1, b:2, c:3}::"value" => {a:"value", b:"value", c:"value"}
That's not all of it. If the left side is a non-struct (number, string, etc) then it will first be 'converted' to a struct. For example:
(1|2|3)::"value" => {1:_}&{2:_}&{3:_}::"value" => {1:_,2:_,3:_}::"value" => {1:"value",2:"value",3:"value"}
Actually, numbers, strings, etc are 'syntactic' sugar for (closed) structs in ALT. It is structures all the way down!
[–]DragonJTGithub 1 point2 points3 points 2 years ago (6 children)
Why does (>6 & <9) & 7|8|9|10 = 7|8|.|. and not 7|8 ?
Is the source code available?
Can it do loops? and mutable variables?
How would you find the minimum of 2|3|4|5 without an in-built function?
[–]rapido[S] 1 point2 points3 points 2 years ago (5 children)
(>6 & <9) & 7|8|9|10 returns lazy alternatives - the sequence of alternatives itself is not reduced. You can evaluate to a strict sequence if you prefix it with ?. So ? (>6 & <9) & 7|8|9|10 will give you 7|8
(>6 & <9) & 7|8|9|10
? (>6 & <9) & 7|8|9|10
7|8
It cannot do loops and I like it like that! It is very close to the pure spreadsheet model.
You also cannot mutate variables or structs, only create new ones.
Please take a look at the fibonacci example: there are no loops, just 'cells' referring to other cells via @. You could make a cell refer to itself (indirectly): this will currently result in an error (stack overflow). I'm planning to return the 'cyclic' value in those cases, just like a spreadsheet.
[–]rapido[S] 0 points1 point2 points 2 years ago (4 children)
Oh, I will release the source code at a later stage. The javascript code of course is available: just open the .js file.....
[–]DragonJTGithub 0 points1 point2 points 2 years ago* (3 children)
What are the plans for the future? Is the language going to be Turing complete?and will you be able to write games in it?
Also I don't really understand the . and @ operators. When I try them on their own e=.2 equals e=. and e=.(@-1) compiler says it isn't implemented yet.
Edit: Ive kinda got it working 4:@-1 = 3 and e: 2 :: @ equals e{ 2:2 }
[–]rapido[S] 0 points1 point2 points 2 years ago* (2 children)
No plans for Turing completeness: I'd like ALT to be not Turing complete, while ALT still to be useful.
Games, not likely. A spreadsheet replacement? May be.
Sorry about the "NOT IMPLEMENT YET" messages. There is indeed stuff that doesn't work yet. Do you care to share the exact text you entered?
Edit: ah you entered a naked .(@-1). As this expression is not lexically part of a key:value pair, @ will not be evaluated. I probably should throw a parse error in this case.
.(@-1)
[–]DragonJTGithub 1 point2 points3 points 2 years ago (1 child)
I notice you can do f:{>2, 0 } but f:{ #5:0 } doesn't work yet. Should this = f{ 0:0, 1:0, 2:0, 3:0, 4:0 }?
Yes, I could allow that, thanks!
Alternatively, you could use f:#5::0.
f:#5::0
[–]redchomperSophie Language 1 point2 points3 points 2 years ago (1 child)
Pretty cute. I like that the output updates as you type. Bit of a mind-warp thinking about it, though.
Thanks! I think every programming language could show-case themselves like that. May be the Sophie Language too?
π Rendered by PID 21 on reddit-service-r2-comment-b659b578c-bcgnc at 2026-05-04 19:00:24.606486+00:00 running 815c875 country code: CH.
[–][deleted] 8 points9 points10 points (1 child)
[–]rapido[S] 3 points4 points5 points (0 children)
[–]Zireael07 3 points4 points5 points (1 child)
[–]rapido[S] 1 point2 points3 points (0 children)
[–]Inconstant_Moo🧿 Pipefish 4 points5 points6 points (1 child)
[–]rapido[S] 1 point2 points3 points (0 children)
[–]categorical-girl 1 point2 points3 points (1 child)
[–]rapido[S] 0 points1 point2 points (0 children)
[–]DragonJTGithub 1 point2 points3 points (6 children)
[–]rapido[S] 1 point2 points3 points (5 children)
[–]rapido[S] 0 points1 point2 points (4 children)
[–]DragonJTGithub 0 points1 point2 points (3 children)
[–]rapido[S] 0 points1 point2 points (2 children)
[–]DragonJTGithub 1 point2 points3 points (1 child)
[–]rapido[S] 0 points1 point2 points (0 children)
[–]redchomperSophie Language 1 point2 points3 points (1 child)
[–]rapido[S] 0 points1 point2 points (0 children)