<p>I am probably lazy so I don't feel like thoroughly designing and implementing a new language. But maybe it already exists? Do any programming languages exist with the following traits?</p>
<ul>
<li><p>no need for whitespaces, only between numbers, all identifiers are one-lettered. If we need a long identifier then use an indexed table element.</p>
</li>
<li><p>polish notation. Because I spent half my life on parentheses.</p>
</li>
<li><p>indexing arrays, tables, functions are the same: <code>f1</code>, <code>t'field'</code></p>
</li>
<li><p>no <code>if</code> operator. Instead we make an array of statements with condition as index.</p>
</li>
<li><p>tacit functions</p>
</li>
</ul>
<p>For example <code>if x&lt;10 then x=y+1 else y=x/2 end</code>  would be <code>{=x+y1, =y/x2}&lt;x10</code>.</p>

<syntax><concatenative-languages>
Prior art for concatenative array language?
CC BY-SA 4.0
2024-07-13T15:34:40.273Z
Added syntax flags as the difference between the mentioned and any other language would likely disappear after syntactic analysis phases. I doubt, however, that the approach is common as most languages tend to more or less use C-style syntax to be consistent with users' prior experiences.
feldentm
CC BY-SA 4.0
2024-07-13T15:45:57.840Z
When the code is trivial and you've done it a thousand times then having to press shift key for parentheses greatly annoys. But for a complex program I'd choose a clear traditional syntax
Марат Рамазанов
CC BY-SA 4.0
2024-07-13T20:37:35.800Z
Try [Uiua](https://www.uiua.org/).
Jon Purdy
CC BY-SA 4.0
2024-07-14T01:45:06.140Z
Many [golfing languages](https://github.com/razetime/code-golf/blob/master/golflang-list.md) are concatenative and support array programming. Some examples are [05AB1E](https://github.com/Adriandmen/05AB1E), [Vyxal](https://github.com/Vyxal/Vyxal), [Nekomata](https://github.com/AlephAlpha/Nekomata).
alephalpha
CC BY-SA 4.0
2024-07-15T22:06:10.227Z
@alephalpha: note that those three are all postfix (RPN) languages, and the OP is specifically asking for polish notation (prefix)
Chris Dodd
CC BY-SA 4.0
2024-09-28T18:29:08.197Z
I’m pretty sure the second and third goal are contradictory. For Polish notation to work, everything needs to have a fixed arity, but you want tables to behave as both constants and functions, meaning that they have a variable arity of 0 or 1.
xigoi
CC BY-SA 4.0
2024-09-29T16:59:54.743Z
If x is a number then I can write "=x1" which means "x=1" . Then I redefine x to be an array or a function and I can write "=x11" which means "x(1)=1 "
Марат Рамазанов
<p>Currently, there's no such programming language that satisfy <em>all</em> of your conditions. However, there <em>are in fact</em> some programming languages that have one or more of the characteristics you mentioned:</p>
<ul>
<li><a href="https://en.wikipedia.org/wiki/Forth_(programming_language)" rel="nofollow noreferrer">Forth</a>: This is by far the closest one to what you're looking for that I can find. It uses reverse polish notation, is stack-based, and is concise in its syntax. However, it <em>does</em> use whitespace as a delimiter. Also, it uses the standard <code>if</code>-statement for conditional control-flow, albeit in a slightly different way, due to the fact that it is a stack-based language. Forth functions (subroutines) are called &quot;words&quot;, and are usually small and concise, although there's no restriction of the length of the words' names.</li>
<li><a href="https://en.wikipedia.org/wiki/APL_(programming_language)" rel="nofollow noreferrer">APL</a>: This is also very close to what you're looking for. Early implementations of the language do not have any control-flow statements (<code>if</code>-<code>elseif</code>-<code>else</code>, <code>for</code>, <code>do</code>-<code>while</code>, ...etc), rather programmers of this language use array operations to perform the task. APL syntax and operators uses many non-ASCII (Unicode) characters. For example, the Unicode character &quot;ι&quot; is used for iteration, &quot;←&quot; used for assignment, &quot;+&quot; is used to add a number to <em>all</em> elements of an array (versus appending), and &quot;×&quot; for multiplication. Note that APL does not satisfy the other features you mentioned; it uses parenthesis as part of the syntax, does not use reverse polish notation, and allows multiple-letter names. Whitespace is also required as part of the syntactic model.</li>
<li><a href="https://en.wikipedia.org/wiki/APL_(programming_language)" rel="nofollow noreferrer">Whitespace</a>: For a programming language that is special in whitespace, this one should have a spot. However, this is the <em>exactly opposite</em> of what you're looking for; this programming language <em>only</em> uses whitespace as syntax. It's also an esoteric language, so don't use it for practical purposes.</li>
</ul>
<p>Finally, let's evaluate the conditions you listed for their practicality:</p>
<ul>
<li>
<blockquote>
<p>no need for whitespaces, only between numbers, all identifiers are one-lettered. If we need a long identifier then use an indexed table element.</p>
</blockquote>
<p>As far as I can find, no (at least no <em>used</em>) programming language had a syntax that does not require any form of whitespace delimiting. There's not much sense in designing a language with such a feature anyway. I think the space key is perhaps the easiest key I can hit, and I would like to stick with that. As for single-lettered names, most programming languages <em>allow</em> single-letter names, but none <em>enforce</em> it. Again, there's not much sense in restricting the length of a variable or function name, since you can always do so yourself. So essentially, every programming language satisfy this condition. Note, however, that using single-letter names for <em>everything</em> in your program is almost always an extraordinarily bad software engineering practice. Using single-lettered names for <em>some</em> things are OK (think <code>i</code> and <code>j</code> for loop variables), but for <em>everything</em> it is not. See <a href="https://www.linkedin.com/pulse/importance-variable-naming-priyanka-hiranandani#:%7E:text=Maintainability%20and%20Debugging%3A%20Well%2Dnamed,are%20involved%20and%20their%20purpose." rel="nofollow noreferrer">importance of variable names</a>, <a href="https://groups.google.com/g/golang-nuts/c/J9QeizedpuI?pli=1" rel="nofollow noreferrer">single-letter variable names</a>, <a href="https://www.cs.huji.ac.il/w%7Efeit/papers/SingleLetter17ICPC.pdf" rel="nofollow noreferrer">the case of single-lettered names</a>, <a href="https://stackoverflow.com/questions/1866794/naming-classes-how-to-avoid-calling-everything-a-whatevermanager">naming classes- stackoverflow</a>, and <a href="https://softwareengineering.stackexchange.com/questions/285288/is-the-use-of-one-letter-variables-encouraged">is single-letter names encouraged</a>.</p>
</li>
<li><p>Polish notation: Many programming languages out there use reverse polish notation, so this one is not particularity hard to find.</p>
</li>
<li>
<blockquote>
<p>indexing arrays, tables, functions are the same: f1, t'field'</p>
</blockquote>
<p>This one is also common. For example, in Python, indexing a dictionary (equivalent to a hash map or table in other languages) is the same as indexing a list (array). However, I don't think there's any programming language that allows <em>indexing of functions</em>. I guess you're referring to the indexing of a heap stack of functions, which some stack-based programming languages do support.</p>
</li>
<li>
<blockquote>
<p>no if operator. Instead we make an array of statements with condition as index.</p>
</blockquote>
<p>Satisfied by APL. This isn't a common feature, so I guess APL is one of those, if not <em>the only one</em> that have this distinction.</p>
</li>
</ul>
<p>I hope this helps!</p>

CC BY-SA 4.0
2024-09-07T23:52:24.927Z
2024-09-07T23:52:24.927Z
Luke L
CC BY-SA 4.0
2024-09-08T00:16:11.340Z
FORTRAN would be a clear example of a used language that does not require whitespace delimiting in expressions, though there are others. I believe the indexing point requests that indexing and application share syntax (like BASIC), but presumably by juxtaposition. The question also seems to be asking for Polish notation rather than *Reverse* Polish notation, both explicitly and in the example code.
Michael Homer
CC BY-SA 4.0
2024-09-08T22:38:36.420Z
"However, I don't think there's any programming language that allows indexing of functions." Doesn't Mathematica use bracket syntax for both indices and function calls?
Bbrk24
CC BY-SA 4.0
2024-09-09T03:26:39.703Z
Any reason for downvoting?
Luke L
CC BY-SA 4.0
2024-09-09T05:53:31.083Z
@Bbrk24 Yeah, you're right. I never even know about that programming language before. Thanks for pointing out. But I don't think Mathematica is what OP's looking for, though. Still, I appreciate your reminder.
Luke L
CC BY-SA 4.0
2024-09-09T15:41:41.263Z
Regarding "indexing of functions": Arrays are (conceptually/mathematically) functions, and indexing an array is applying it. For instance, an `int` array of size `n` is a function from the set `{0, 1, ..., n-1}` to the set of `int` values. "Indexing" is just another way to think about what it means to apply a function. In fact, sometimes a function like that would be called "an [indexed family](https://en.wikipedia.org/wiki/Indexed_family) of `int`s," instead of saying "function."
David Young
CC BY-SA 4.0
2024-09-09T23:16:17.130Z
@DavidYoung I'm not so sure about the mathematics side of things, but in software engineering, we usually do not thin of arrays as "functions", but rather "data structures" that function can take as input.
Luke L
CC BY-SA 4.0
2024-09-13T14:38:44.967Z
I forgot to add tacit functions. The features that I want are so natural that the interpreter for such a language will be the simplest possible.
Марат Рамазанов
<p>Other than single-letter identifiers, it sounds like you're looking for <a href="https://en.wikipedia.org/wiki/APL_(programming_language)" rel="nofollow noreferrer">APL</a>.</p>

CC BY-SA 4.0
2024-07-18T11:33:21.263Z
2024-07-18T11:33:21.263Z
Ross Patterson
CC BY-SA 4.0
2024-07-18T17:19:49.300Z
As it’s currently written, your answer is unclear. Please [edit] to add additional details that will help others understand how this addresses the question asked. You can find more information on how to write good answers [in the help center](/help/how-to-answer).
Community Compiler
# Prior art for concatenative array language?
Posted by: username_0 on 2024-07-13
I am probably lazy so I don't feel like thoroughly designing and implementing a new language. But maybe it already exists? Do any programming languages exist with the following traits?

* no need for whitespaces, only between numbers, all identifiers are one-lettered. If we need a long identifier then use an indexed table element.
* polish notation. Because I spent half my life on parentheses.
* indexing arrays, tables, functions are the same: `f1`, `t'field'`
* no `if` operator. Instead we make an array of statements with condition as index.
* tacit functions

For example `if x<10 then x=y+1 else y=x/2 end` would be `{=x+y1, =y/x2}.`
**Tags:** syntax concatenative-languages
> **Comments:**
> **username_1**: Added syntax flags as the difference between the mentioned and any other language would likely disappear after syntactic analysis phases. I doubt, however, that the approach is common as most languages tend to more or less use C-style syntax to be consistent with users' prior experiences.  
> **username_0**: When the code is trivial and you've done it a thousand times then having to press shift key for parentheses greatly annoys. But for a complex program I'd choose a clear traditional syntax  
> **username_2**: Try [Uiua](https://www.uiua.org/).  
> **username_3**: Many [golfing languages](https://github.com/razetime/code-golf/blob/master/golflang-list.md) are concatenative and support array programming. Some examples are [05AB1E](https://github.com/Adriandmen/05AB1E), [Vyxal](https://github.com/Vyxal/Vyxal), [Nekomata](https://github.com/AlephAlpha/Nekomata).  
> **username_4**: @alephalpha: note that those three are all postfix (RPN) languages, and the OP is specifically asking for polish notation (prefix)  
> **username_5**: I’m pretty sure the second and third goal are contradictory. For Polish notation to work, everything needs to have a fixed arity, but you want tables to behave as both constants and functions, meaning that they have a variable arity of 0 or 1.  
> **username_0**: If x is a number then I can write "=x1" which means "x=1" . Then I redefine x to be an array or a function and I can write "=x11" which means "x(1)=1 "  
---
## 2 answers
### Answer by username_6 on 2024-09-07. Score: 2
Currently, there's no such programming language that satisfy *all* of your conditions. However, there *are in fact* some programming languages that have one or more of the characteristics you mentioned:

* [Forth](https://en.wikipedia.org/wiki/Forth_(programming_language)): This is by far the closest one to what you're looking for that I can find. It uses reverse polish notation, is stack-based, and is concise in its syntax. However, it *does* use whitespace as a delimiter. Also, it uses the standard `if`-statement for conditional control-flow, albeit in a slightly different way, due to the fact that it is a stack-based language. Forth functions (subroutines) are called "words", and are usually small and concise, although there's no restriction of the length of the words' names.
* [APL](https://en.wikipedia.org/wiki/APL_(programming_language)): This is also very close to what you're looking for. Early implementations of the language do not have any control-flow statements (`if`-`elseif`-`else`, `for`, `do`-`while`, ...etc), rather programmers of this language use array operations to perform the task. APL syntax and operators uses many non-ASCII (Unicode) characters. For example, the Unicode character "ι" is used for iteration, "←" used for assignment, "+" is used to add a number to *all* elements of an array (versus appending), and "×" for multiplication. Note that APL does not satisfy the other features you mentioned; it uses parenthesis as part of the syntax, does not use reverse polish notation, and allows multiple-letter names. Whitespace is also required as part of the syntactic model.
* [Whitespace](https://en.wikipedia.org/wiki/APL_(programming_language)): For a programming language that is special in whitespace, this one should have a spot. However, this is the *exactly opposite* of what you're looking for; this programming language *only* uses whitespace as syntax. It's also an esoteric language, so don't use it for practical purposes.

Finally, let's evaluate the conditions you listed for their practicality:

* > no need for whitespaces, only between numbers, all identifiers are one-lettered. If we need a long identifier then use an indexed table element.

  As far as I can find, no (at least no *used*) programming language had a syntax that does not require any form of whitespace delimiting. There's not much sense in designing a language with such a feature anyway. I think the space key is perhaps the easiest key I can hit, and I would like to stick with that. As for single-lettered names, most programming languages *allow* single-letter names, but none *enforce* it. Again, there's not much sense in restricting the length of a variable or function name, since you can always do so yourself. So essentially, every programming language satisfy this condition. Note, however, that using single-letter names for *everything* in your program is almost always an extraordinarily bad software engineering practice. Using single-lettered names for *some* things are OK (think `i` and `j` for loop variables), but for *everything* it is not. See [importance of variable names](https://www.linkedin.com/pulse/importance-variable-naming-priyanka-hiranandani#:%7E:text=Maintainability%20and%20Debugging%3A%20Well%2Dnamed,are%20involved%20and%20their%20purpose.), [single-letter variable names](https://groups.google.com/g/golang-nuts/c/J9QeizedpuI?pli=1), [the case of single-lettered names](https://www.cs.huji.ac.il/w%7Efeit/papers/SingleLetter17ICPC.pdf), [naming classes- stackoverflow](https://stackoverflow.com/questions/1866794/naming-classes-how-to-avoid-calling-everything-a-whatevermanager), and [is single-letter names encouraged](https://softwareengineering.stackexchange.com/questions/285288/is-the-use-of-one-letter-variables-encouraged).
* Polish notation: Many programming languages out there use reverse polish notation, so this one is not particularity hard to find.
* > indexing arrays, tables, functions are the same: f1, t'field'

  This one is also common. For example, in Python, indexing a dictionary (equivalent to a hash map or table in other languages) is the same as indexing a list (array). However, I don't think there's any programming language that allows *indexing of functions*. I guess you're referring to the indexing of a heap stack of functions, which some stack-based programming languages do support.
* > no if operator. Instead we make an array of statements with condition as index.

  Satisfied by APL. This isn't a common feature, so I guess APL is one of those, if not *the only one* that have this distinction.

I hope this helps!
> **Comments:**
> **username_7** (2024-09-08): FORTRAN would be a clear example of a used language that does not require whitespace delimiting in expressions, though there are others. I believe the indexing point requests that indexing and application share syntax (like BASIC), but presumably by juxtaposition. The question also seems to be asking for Polish notation rather than *Reverse* Polish notation, both explicitly and in the example code.  
> **username_8** (2024-09-08): "However, I don't think there's any programming language that allows indexing of functions." Doesn't Mathematica use bracket syntax for both indices and function calls?  
> **username_6** (2024-09-09): Any reason for downvoting?  
> **username_6** (2024-09-09): @Bbrk24 Yeah, you're right. I never even know about that programming language before. Thanks for pointing out. But I don't think Mathematica is what OP's looking for, though. Still, I appreciate your reminder.  
> **username_9** (2024-09-09): Regarding "indexing of functions": Arrays are (conceptually/mathematically) functions, and indexing an array is applying it. For instance, an `int` array of size `n` is a function from the set `{0, 1, ..., n-1}` to the set of `int` values. "Indexing" is just another way to think about what it means to apply a function. In fact, sometimes a function like that would be called "an [indexed family](https://en.wikipedia.org/wiki/Indexed_family) of `int`s," instead of saying "function."  
> **username_6** (2024-09-09): @DavidYoung I'm not so sure about the mathematics side of things, but in software engineering, we usually do not thin of arrays as "functions", but rather "data structures" that function can take as input.  
> **username_0** (2024-09-13): I forgot to add tacit functions. The features that I want are so natural that the interpreter for such a language will be the simplest possible.  
---
### Answer by username_10 on 2024-07-18. Score: 0
Other than single-letter identifiers, it sounds like you're looking for [APL](https://en.wikipedia.org/wiki/APL_(programming_language)).
> **Comments:**
> **username_11** (2024-07-18): As it’s currently written, your answer is unclear. Please [edit] to add additional details that will help others understand how this addresses the question asked. You can find more information on how to write good answers [in the help center](/help/how-to-answer).  
---
