<p>Why do many programming languages use brackets <code>()</code> for function definitions and calls?</p>
<p>For example, in Python:</p>
<pre class="lang-python prettyprint-override"><code>def f(): ...

f()
</code></pre>
<p>In Go:</p>
<pre class="lang-go prettyprint-override"><code>func f() { ... }

f()
</code></pre>
<p>Many other languages use similar syntax.</p>

<syntax><language-design><functions>
Why do many programming languages use parentheses `()` for function definitions and calls?
CC BY-SA 4.0
2023-06-03T08:54:34.490Z
Because that is the [mathematical notation for applying a function](https://en.wikipedia.org/wiki/Function_(mathematics)#Notation).
alephalpha
CC BY-SA 4.0
2024-04-30T17:39:21.073Z
It's also waaaaaay easier to parse than a simple space after the function name and overall less ambiguous for complex chains of function calls.
Beefster
<h2>Mathematical Notation</h2>
<p>The concept of a &quot;function&quot; which maps a particular input to a particular output originates in mathematics. A common notation for defining and applying functions in mathematics is <span class="math-container">$f(x)$</span> where <span class="math-container">$f$</span> is the function, and <span class="math-container">$x$</span> represents its input.</p>
<p>This dates back far beyond the birth of programming, to the 18th Century; for instance <a href="https://archive.org/details/in.ernet.dli.2015.88254/page/n291/mode/2up" rel="nofollow noreferrer">Cajori, &quot;A History of Mathematical Notations&quot;, volume 2, paragraph 643</a> states (hat tip to <a href="https://langdev.stackexchange.com/users/2160/robertr">RobertR</a> for providing this reference in a comment):</p>
<blockquote>
<p>The use of parentheses for this purpose occurs in Euler in 1734, who says, &quot;Si <span class="math-container">$f(x/a+c)$</span> denotet functionem quamcunque ipsius <span class="math-container">$x/a+c$</span>&quot;</p>
</blockquote>
<p>That these parentheses are to indicate function application, not merely precedence, is clearer in other examples from later in that section:</p>
<blockquote>
<p>Another time [Lagrange] wrote Clairaut's equation, <span class="math-container">$y-px+f(p)=0$</span>, &quot;<span class="math-container">$f(p)$</span> dénotant une fonction quelconque de <span class="math-container">$p$</span> seul&quot;</p>
</blockquote>
<p>Other notations do occur in mathematics, such as reserving Greek letters as function names, and letting <span class="math-container">$\phi x$</span> represent application of <span class="math-container">$\phi$</span> to input <span class="math-container">$x$</span>. But <strong>using <span class="math-container">$f(x)$</span> is probably the notation most people are familiar with</strong>, as can be seen in introductory teaching material (some more-or-less random examples: <a href="https://openstax.org/books/college-algebra-2e/pages/3-1-functions-and-function-notation" rel="nofollow noreferrer">openstax</a>, <a href="https://www.symbolab.com/study-guides/boundless-algebra/introduction-to-functions.html" rel="nofollow noreferrer">Symbolab</a>, <a href="https://math.libretexts.org/Bookshelves/Algebra/Intermediate_Algebra_(Arnold)/02%3A_Functions/2.01%3A_Introduction_to_Functions" rel="nofollow noreferrer">LibreTexts</a>, <a href="https://mathhints.com/intermediate-algebra/introduction-to-functions/" rel="nofollow noreferrer">MathHints</a>).</p>
<h2>Influence of Early Programming Languages</h2>
<p>Many <strong>early programming languages were explicitly inspired by mathematical notation</strong>, and intended for use by those familiar with algebra. For instance, <a href="http://archive.computerhistory.org/resources/text/Fortran/102649787.05.01.acc.pdf" rel="nofollow noreferrer">the first manual for FORTRAN, dated 1956</a> says:</p>
<blockquote>
<p>A FORTRAN arithmetic formula resembles very closely a conventional arithmetic formula; it consists of the variable to be computed, followed by an <code>=</code> sign, followed by an arithmetic expression. For example, the arithmetic formula <code>Y = A-SINF(B-C)</code> means &quot;replace the value of y by the value of a-sin(b-c)&quot;.</p>
</blockquote>
<p>To use a function in such expressions, &quot;The name of the function is followed by
parentheses enclosing the arguments (which may be expressions), separated by commas.&quot; It's worth noting that FORTRAN also used parentheses for &quot;subscripts&quot; on a variable - accessing elements of a 1-, 2-, or 3-dimensional array. Function names were distinguished from variable names by requiring the last letter to be &quot;F&quot;. The original implementation used a 6-bit character encoding, so the limited range of symbols available may have played a part in its design.</p>
<p>At the same time, ALGOL was being designed in committee as an &quot;International Algebraic Language&quot;. The Preliminary Report describing it in <a href="https://doi.org/10.1145/377924.594925" rel="nofollow noreferrer">Communications of the ACM, Volume 1, Issue 12</a> includes as the first agreed objective:</p>
<blockquote>
<p>The new language should be as close as possible to standard mathematical notation and be readable with little further explanation.</p>
</blockquote>
<p>In the &quot;Reference Language&quot; used to define ALGOL in that report, the form for functions is denoted as:</p>
<blockquote>
<p>Form: <span class="math-container">$F ⁓ I (P, P, . . . ., P)$</span> where <span class="math-container">$I$</span> is an identifier, and <span class="math-container">$P, P, . . . . , P$</span> is the ordered list of actual parameters</p>
</blockquote>
<p>Unlike FORTRAN, the reference definition of ALGOL used arbitrary symbols, so the choice of parentheses is not due to a constraint on available characters.</p>
<p><strong>These early languages, and particularly ALGOL, were hugely influential</strong>, having a clear influence on the syntax of nearly every procedural language since.</p>
<h2>Practical Advantages</h2>
<p>As well as the influence of mathematical notation, and early languages, the use of parentheses has a number of practical advantages over other possibilities.</p>
<p>Using single-symbol function names and juxtaposition, as in <span class="math-container">$\phi x$</span>, would severely limit the number and readability of functions in anything but the smallest programs.</p>
<p>Separating the function name from its arguments with spaces is possible, but leads to an ambiguity between nesting and multiple parameters: does <code>f a b</code> represent <code>f(a, b)</code> or <code>f(a(b))</code> or <code>f(a)(b)</code>, etc. As discussed on <a href="https://langdev.stackexchange.com/a/3722/1769">this related answer</a>, there are some styles of programming language where this has a natural default, and this style is used.</p>

CC BY-SA 4.0
2024-04-23T18:52:39.477Z
2024-04-23T18:52:39.477Z
IMSoP
<h2>Warning: This Idea is not Yet Widely Adopted</h2>
<p>Below, I describe why we write functions definitions and function calls with parentheses <code>()</code>.</p>
<p>However, I will warn you, that this newer model for programming languages and is <em><strong>not</strong></em> a popular model at the time of my writing.</p>
<hr />
<h2>Parentheses <code>()</code> indicate that a several distinctly different things should be grouped together into one single unified object</h2>
<p>Let us take the <code>pow</code> function as an example.</p>
<p><code>pow</code> is the name for one of the many canonical function some students write when practicing and learning how to write code.</p>
<p>For example, <code>pow(10, 4)</code> will make the computer leave what it was doing, go calculate somthing, and <strong>return</strong> with a value of <code>1000</code>.</p>
<p>In the notation <code>pow(base, exp)</code> we are applying a function named <code>pow</code> to <em><strong>one single input</strong></em>, not <em>two</em> separate inputs.</p>
<p>The input to the <code>pow</code> function is an instance of an an <em><strong>anonymous class</strong></em> such that the <em><strong>anonymous class</strong></em> has fields named <code>base</code> and <code>exp</code>.</p>
<p>That is, we might write,</p>
<pre class="lang-python prettyprint-override"><code>float base = 0.901;
int   exp  = 30;  

# Below this comment, we create an ***anonymous class*** having attributes named `base` and `exp`
# 
# we instantiate the anonymous class and then assign
# the instance to a memory address with label `args`
# 
# The instance has a name, but the class has no name. 

args   = (base, exp) 
result = pow(args)

# COMMENT FOR HUMAN EYES ONLY:
#    result = 0.04382720037 
</code></pre>
<hr />
<h3>Digression</h3>
<blockquote>
<p>You asked what paratheses <code>()</code> do in the definition and call of a function in a computer programme.</p>
<p>I consider that to be a basic thing students encounter early on in their studies of computer programming.</p>
<p>Therefore, the following digression might help you:</p>
</blockquote>
<pre class="lang-python prettyprint-override"><code>float base = 0.901;
int   exp  = 30;  
args   = (base, exp) 
result = pow(args)  
</code></pre>
<blockquote>
<ul>
<li><p><code>args</code> are arguments or inputs to a function</p>
</li>
<li><p><code>int</code> is <code>integer</code> or <code>whole number</code> 1, 2, 3,891, et cetra...</p>
</li>
<li><p>Electronic computers delete all comments before translating code into machine language. Electronic computers cannot read or understand most comments.</p>
</li>
</ul>
</blockquote>
<hr />
<p>In our newer model of programming language syntax, all functions accept <em><strong>ONE input</strong></em> and <em><strong>only one input</strong></em>.</p>
<p>Consider this <a href="https://github.com/caesar0301/treelib/blob/7e1daf126bceeded2698d583d847bd7fae0880d8/treelib/tree.py" rel="nofollow noreferrer">code</a> written to implement somthing known as a <a href="https://github.com/caesar0301/treelib/blob/7e1daf126bceeded2698d583d847bd7fae0880d8/treelib/tree.py" rel="nofollow noreferrer"><code>btree</code></a>:</p>
<pre class="lang-python prettyprint-override"><code> def __print_backend(
        self,
        nid=None,
        level=ROOT,
        idhidden=True,
        filter=None,
        key=None,
        reverse=False,
        line_type=&quot;ascii-ex&quot;,
        data_property=None,
        sorting=True,
        func=print,
    ):
    pass 
</code></pre>
<p>In an old-fashioned view of things, the function has 11 inputs.</p>
<p>However, one of many newer views of things is to represent the function as having one single input, such that that single object has 11 separate attributes.</p>
<p>Consider the event in which a computer programmer writes the following piece of code:</p>
<pre class="lang-python prettyprint-override"><code>foobar(arg1, arg2, arg3)
</code></pre>
<p>For our example function named <code>foobar</code>, the input arguments 1, 2 and 3 are all bundled, by a compiler, into a single <em><strong>anonymous class object</strong></em>.</p>
<p>At the time of my writing <em><strong>anonymous</strong></em> class objects are not very popular.</p>
<p>However, functions of no name (<a href="https://en.wikipedia.org/wiki/Anonymous_function" rel="nofollow noreferrer">anonymous functions</a>) are very popular in some programming languages such as <a href="https://en.wikipedia.org/wiki/Python_(programming_language)" rel="nofollow noreferrer">python</a> and the <a href="https://en.wikipedia.org/wiki/MATLAB" rel="nofollow noreferrer">Matrix Laboratory</a> (MatLab).</p>
<p>The purpose of parentheses in functions is to bundle together smaller objects into a larger, more complex, instance of an anonymous class.</p>
<p>In turn, one of the advantages to using parentheses <code>()</code> to create anonymous classes is so that we can use <strong>in-fix</strong> lexors/tokenizers instead of a <strong>pre-fix</strong> lexors, tokenizers, and/or parsers.</p>
<p><code>pow(base, exp)</code> is not a pre-fix function applied to two inputs.</p>
<p>Rather, <code>pow</code> is the left-most argument to the anonymous in-fix operator.</p>
<pre><code>anonymous in-fix operator
├─ pow
├─ instance of an anonymous class (base, exp)
│  ├─ base
│  ├─ exp
</code></pre>
<p>When studying arithmetic, children learn that <code>(10)(5) = 10*5</code>.</p>
<p>The product of <code>10</code> and <code>5</code> need not have a multiplication sign <em>explicitly</em> written.</p>
<p>Likewise, <code>10y</code> is the same thing as <code>10 × y</code></p>
<p><a href="https://i.sstatic.net/uf4rx.jpg" rel="nofollow noreferrer"><img src="https://i.sstatic.net/uf4rx.jpg" alt="PICTURE OF A SYNTAX TREE FOR PARSING POW(BASE, EXP)" /></a></p>
<p>Instead of parsing characters, I recommend parsing transitions between characters.</p>
<blockquote>
<p><code>pow(base, exp)</code></p>
<div class="s-table-container">
<table class="s-table">
<thead>
<tr>
<th>transition from character to character</th>
<th>description</th>
</tr>
</thead>
<tbody>
<tr>
<td><code>po</code></td>
<td>transition from <code>p</code> to <code>o</code></td>
</tr>
<tr>
<td><code>ow</code></td>
<td>transition from <code>o</code> to <code>w</code></td>
</tr>
<tr>
<td><code>w(</code></td>
<td>transition from <code>w</code> to <code>(</code></td>
</tr>
<tr>
<td><code>(b</code></td>
<td>transition from <code>(</code> to <code>b</code></td>
</tr>
<tr>
<td><code>ba</code></td>
<td>transition from <code>b</code> to <code>a</code></td>
</tr>
</tbody>
</table>
</div></blockquote>
<p>Transitioning from <code>w</code> to <code>(</code> should create a token for the implicit multiplication operator, or perhaps, we might call it the anonymous infix operator.</p>
<hr />

CC BY-SA 4.0
2023-10-14T03:42:50.437Z
2023-10-16T02:00:32.647Z
2023-10-16T02:00:32.647Z
Samuel Muldoon
CC BY-SA 4.0
2023-10-14T08:20:53.190Z
*"pow is the left-most argument to the anonymous in-fix operator."* - `pow` represents a function pointer. I wouldn't necessarily conceive the call operator as an "anonymous infix operator". In most languages, the call operator effectively has a compound syntax (that can't be broken down further into elements), with the left bracket separating the first two operands, commas separating further operands, and the right bracket unambiguously terminating the list of operands on the right (including coping with the case of calling a niladic function, where there is only one operand to the operator).
Steve
CC BY-SA 4.0
2023-10-14T08:37:04.420Z
I don't get what this is supposed to say. It seems to be rather about *semantic* interpretation of function calls, not necessarily of its *syntax*. For many parts it is hard to tell what is intended to be *your own* view as opposed to that of *(developers) of many programming languages*. Please consider to [edit] for clarity.
MisterMiyagi
CC BY-SA 4.0
2023-10-14T14:06:57.743Z
"Anonymous class objects are not very popular" this is false: most languages that are object oriented also have anonymous class syntax. "Anonymous functions are very popular in **some** programming languages" also false. Most widely used languages these days (except C) have anonymous function syntax.
Seggan
CC BY-SA 4.0
2023-10-14T15:09:14.587Z
I really like this approach for handling `()`, it's one I plan on going with for a future language I'm making (mainly since it means function calls with anonymous structs are a convenient way to do named arguments). But I don't think it this is the reason most, if any, existing languages have for this syntax.
rydwolf
CC BY-SA 4.0
2023-10-16T01:45:53.477Z
@Steve The transition from alpha-numeric characters to non-alphanumeric characters `w(b` inside of the string of text `pow(base, exp)` will eventually resolve to be the call-operator. However, consider `3(1 + 2)` and `(3)(1) + 2` and `10(x + y)` when the string of text located to the left of the parentheses is numbers only, such as `10`, then the anonymous infix operator will resolve to multiplication operator for float, integers, or other numeric data-types.
Samuel Muldoon
CC BY-SA 4.0
2023-10-16T01:46:50.437Z
@Steve The anonymous infix operator only resolves into the call-operator when the left-most token is associated with a function, method, functor, or other callable object.
Samuel Muldoon
CC BY-SA 4.0
2023-10-16T01:52:34.010Z
@MisterMiyagi Suppose that `F` is a function. Some programming languages, such as Java, C++, and Python, might appear to be a mixture of (1 infix notation `xFy`) and (2 prefix notation `Fxy`). For example, `1 + 2` is written in infix notation, but `mkdir()` is written in prefix notation. I think that it helps to view the whole thing as infix notation. In the mathematical expression, `10(y+z)` the multiplication sign is missing. Likewise, an infix symbol for the function-call operator is absent from the string `mkdir()`. It helps to think of a function being multiplied against its input args.
Samuel Muldoon
CC BY-SA 4.0
2023-10-16T01:56:28.983Z
@MisterMiyagi Note that `10(y + z)` is `10*(y + z)` where the asterisk `*` represents multiplication of `int`s and/or integer privatives, also known as whole numbers 1, 2, .... 912, etc... Likewise in the expression `mkdir()` we might have `mkdir*()`. That is, when no infix operator is written, we can imagine an invisible, hidden infix operator. This hidden infix operator might be nameless, or anonymous, just as anonymous functions are functions which have the potential to have no explicit label or name.
Samuel Muldoon
CC BY-SA 4.0
2023-10-16T01:58:05.213Z
@MisterMiyagi Suppose that `CALL` is the name we use for the operator which causes a function to be called or invoked. Then `CALL` takes two arguments: a function and a container of arguments. The parentheses `()` serve to create a single container of many arguments. Perhaps `CALL` cannot accept 3 input arguments, or 4 input arguments. If `CALL` is binary, then the arguments must be glued together to form one single object.
Samuel Muldoon
CC BY-SA 4.0
2023-10-16T09:29:52.307Z
@SamuelMuldoon, in programming, I'd reckon that multiplication isn't important enough to be given its own special syntax based on juxtaposition (i.e. the "anonymous infix operator").
Steve
CC BY-SA 4.0
2023-10-16T10:29:03.927Z
@SamuelMuldoon All those are reasons why *a developer might* want to use `function(arg1, arg2, ...)` syntax – notably not binding ones, as the semantics you describe aren't how many languages treat things and there are several languages that show it can be done completely differently. I don't see how those are reasons that *many specific, existing languages* have chosen to use that syntax. In fact, the intro of this answer ("this newer model for programming languages and is not a popular model at the time of my writing") suggests these consideration *aren't* why the syntax is commonly used.
MisterMiyagi
CC BY-SA 4.0
2023-10-16T20:53:43.363Z
What you call an “anonymous class object” is present in many modern languages and usually called a *tuple*. A few programming languages have functions systematically take a tuple as a single argument, notably Standard ML. (Many ML-like languages also have functions take a single argument, but they favor currying for multiple arguments.) Lisp, one of the oldest programming languages, also has arguments packed into a single data structure; in Lisp, that's a list, because Lisp is built around lists. But most languages don't do that because packing arguments transparently just isn't that useful.
Gilles 'SO- stop being evil'
<p>Because of math functions.</p>
<p>Like this:</p>
<pre class="lang-none prettyprint-override"><code>f(x) = x + 5
</code></pre>
<p><a href="https://en.wikipedia.org/wiki/Function_(mathematics)#Notation" rel="noreferrer">Wikipedia</a></p>

CC BY-SA 4.0
2023-06-03T08:36:10.343Z
2023-06-03T08:56:33.743Z
2023-06-03T08:56:33.743Z
чистов_n
CC BY-SA 4.0
2023-10-15T18:58:45.813Z
That said, many functions, such as `sin`, are often written without parentheses in math.
xigoi
CC BY-SA 4.0
2024-04-21T21:46:30.583Z
Maths notation never used parentheses unless they are needed to disambiguate things
Chris Dodd
CC BY-SA 4.0
2024-04-23T17:23:50.790Z
@ChrisDodd Citation please. I searched the web for "introductory algebra functions", and every course I found describes `f(x)` as the standard or most common notation: https://mathhints.com/intermediate-algebra/introduction-to-functions/ and https://math.libretexts.org/Bookshelves/Algebra/Intermediate_Algebra_(Arnold)/02%3A_Functions/2.01%3A_Introduction_to_Functions and https://www.symbolab.com/study-guides/boundless-algebra/introduction-to-functions.html and https://openstax.org/books/college-algebra-2e/pages/3-1-functions-and-function-notation
IMSoP
CC BY-SA 4.0
2024-04-28T16:01:26.903Z
@ChrisDodd I think you're referring to functions such as trig functions and logarithms. In those cases some people only use parentheses in order to disambiguate things, while others use them all the time. However, when referring to functions that are not those, such as f and g, I've never seen them used without parentheses.
pigrammer
# Why do many programming languages use parentheses `()` for function definitions and calls?
Posted by: username_0 on 2023-06-03
Why do many programming languages use brackets () for function definitions and calls?
For example, in Python:
def f(): ...

f()

In Go:
func f() { ... }

f()

Many other languages use similar syntax.
**Tags:** syntax language-design functions
> **Comments:**
> **username_1**: Because that is the [mathematical notation for applying a function](https://en.wikipedia.org/wiki/Function_(mathematics)#Notation).  
> **username_2**: It's also waaaaaay easier to parse than a simple space after the function name and overall less ambiguous for complex chains of function calls.  
---
## 3 answers
### Answer by username_0 on 2023-06-03. Score: 14
Because of math functions.
Like this:
f(x) = x + 5

Wikipedia
> **Comments:**
> **username_10** (2023-10-15): That said, many functions, such as `sin`, are often written without parentheses in math.  
> **username_11** (2024-04-21): Maths notation never used parentheses unless they are needed to disambiguate things  
> **username_3** (2024-04-23): @ChrisDodd Citation please. I searched the web for "introductory algebra functions", and every course I found describes `f(x)` as the standard or most common notation: https://mathhints.com/intermediate-algebra/introduction-to-functions/ and https://math.libretexts.org/Bookshelves/Algebra/Intermediate_Algebra_(Arnold)/02%3A_Functions/2.01%3A_Introduction_to_Functions and https://www.symbolab.com/study-guides/boundless-algebra/introduction-to-functions.html and https://openstax.org/books/college-algebra-2e/pages/3-1-functions-and-function-notation  
> **username_12** (2024-04-28): @ChrisDodd I think you're referring to functions such as trig functions and logarithms. In those cases some people only use parentheses in order to disambiguate things, while others use them all the time. However, when referring to functions that are not those, such as f and g, I've never seen them used without parentheses.  
---
### Answer by username_3 on 2024-04-23. Score: -1
## Mathematical Notation

The concept of a "function" which maps a particular input to a particular output originates in mathematics. A common notation for defining and applying functions in mathematics is $f(x)$ where $f$ is the function, and $x$ represents its input.

This dates back far beyond the birth of programming, to the 18th Century; for instance [Cajori, "A History of Mathematical Notations", volume 2, paragraph 643](https://archive.org/details/in.ernet.dli.2015.88254/page/n291/mode/2up) states (hat tip to [RobertR](https://langdev.stackexchange.com/users/2160/robertr) for providing this reference in a comment):

> The use of parentheses for this purpose occurs in Euler in 1734, who says, "Si $f(x/a+c)$ denotet functionem quamcunque ipsius $x/a+c$"

That these parentheses are to indicate function application, not merely precedence, is clearer in other examples from later in that section:

> Another time [Lagrange] wrote Clairaut's equation, $y-px+f(p)=0$, "$f(p)$ dénotant une fonction quelconque de $p$ seul"

Other notations do occur in mathematics, such as reserving Greek letters as function names, and letting $\phi x$ represent application of $\phi$ to input $x$. But **using $f(x)$ is probably the notation most people are familiar with**, as can be seen in introductory teaching material (some more-or-less random examples: [openstax](https://openstax.org/books/college-algebra-2e/pages/3-1-functions-and-function-notation), [Symbolab](https://www.symbolab.com/study-guides/boundless-algebra/introduction-to-functions.html), [LibreTexts](https://math.libretexts.org/Bookshelves/Algebra/Intermediate_Algebra_(Arnold)/02%3A_Functions/2.01%3A_Introduction_to_Functions), [MathHints](https://mathhints.com/intermediate-algebra/introduction-to-functions/)).

## Influence of Early Programming Languages

Many **early programming languages were explicitly inspired by mathematical notation**, and intended for use by those familiar with algebra. For instance, [the first manual for FORTRAN, dated 1956](http://archive.computerhistory.org/resources/text/Fortran/102649787.05.01.acc.pdf) says:

> A FORTRAN arithmetic formula resembles very closely a conventional arithmetic formula; it consists of the variable to be computed, followed by an `=` sign, followed by an arithmetic expression. For example, the arithmetic formula `Y = A-SINF(B-C)` means "replace the value of y by the value of a-sin(b-c)".

To use a function in such expressions, "The name of the function is followed by
parentheses enclosing the arguments (which may be expressions), separated by commas." It's worth noting that FORTRAN also used parentheses for "subscripts" on a variable - accessing elements of a 1-, 2-, or 3-dimensional array. Function names were distinguished from variable names by requiring the last letter to be "F". The original implementation used a 6-bit character encoding, so the limited range of symbols available may have played a part in its design.

At the same time, ALGOL was being designed in committee as an "International Algebraic Language". The Preliminary Report describing it in [Communications of the ACM, Volume 1, Issue 12](https://doi.org/10.1145/377924.594925) includes as the first agreed objective:

> The new language should be as close as possible to standard mathematical notation and be readable with little further explanation.

In the "Reference Language" used to define ALGOL in that report, the form for functions is denoted as:

> Form: $F ⁓ I (P, P, . . . ., P)$ where $I$ is an identifier, and $P, P, . . . . , P$ is the ordered list of actual parameters

Unlike FORTRAN, the reference definition of ALGOL used arbitrary symbols, so the choice of parentheses is not due to a constraint on available characters.

**These early languages, and particularly ALGOL, were hugely influential**, having a clear influence on the syntax of nearly every procedural language since.

## Practical Advantages

As well as the influence of mathematical notation, and early languages, the use of parentheses has a number of practical advantages over other possibilities.

Using single-symbol function names and juxtaposition, as in $\phi x$, would severely limit the number and readability of functions in anything but the smallest programs.

Separating the function name from its arguments with spaces is possible, but leads to an ambiguity between nesting and multiple parameters: does `f a b` represent `f(a, b)` or `f(a(b))` or `f(a)(b)`, etc. As discussed on [this related answer](https://langdev.stackexchange.com/a/3722/1769), there are some styles of programming language where this has a natural default, and this style is used.
---
### Answer by username_4 on 2023-10-14. Score: -8
Warning: This Idea is not Yet Widely Adopted
Below, I describe why we write functions definitions and function calls with parentheses ().
However, I will warn you, that this newer model for programming languages and is not a popular model at the time of my writing.

Parentheses () indicate that a several distinctly different things should be grouped together into one single unified object
Let us take the pow function as an example.
pow is the name for one of the many canonical function some students write when practicing and learning how to write code.
For example, pow(10, 4) will make the computer leave what it was doing, go calculate somthing, and return with a value of 1000.
In the notation pow(base, exp) we are applying a function named pow to one single input, not two separate inputs.
The input to the pow function is an instance of an an anonymous class such that the anonymous class has fields named base and exp.
That is, we might write,
float base = 0.901;
int   exp  = 30;  

# Below this comment, we create an ***anonymous class*** having attributes named `base` and `exp`
# 
# we instantiate the anonymous class and then assign
# the instance to a memory address with label `args`
# 
# The instance has a name, but the class has no name. 

args   = (base, exp) 
result = pow(args)

# COMMENT FOR HUMAN EYES ONLY:
#    result = 0.04382720037 


Digression

You asked what paratheses () do in the definition and call of a function in a computer programme.
I consider that to be a basic thing students encounter early on in their studies of computer programming.
Therefore, the following digression might help you:

float base = 0.901;
int   exp  = 30;  
args   = (base, exp) 
result = pow(args)  



args are arguments or inputs to a function

int is integer or whole number 1, 2, 3,891, et cetra...

Electronic computers delete all comments before translating code into machine language. Electronic computers cannot read or understand most comments.




In our newer model of programming language syntax, all functions accept ONE input and only one input.
Consider this code written to implement somthing known as a btree:
 def __print_backend(
        self,
        nid=None,
        level=ROOT,
        idhidden=True,
        filter=None,
        key=None,
        reverse=False,
        line_type="ascii-ex",
        data_property=None,
        sorting=True,
        func=print,
    ):
    pass 

In an old-fashioned view of things, the function has 11 inputs.
However, one of many newer views of things is to represent the function as having one single input, such that that single object has 11 separate attributes.
Consider the event in which a computer programmer writes the following piece of code:
foobar(arg1, arg2, arg3)

For our example function named foobar, the input arguments 1, 2 and 3 are all bundled, by a compiler, into a single anonymous class object.
At the time of my writing anonymous class objects are not very popular.
However, functions of no name (anonymous functions) are very popular in some programming languages such as python and the Matrix Laboratory (MatLab).
The purpose of parentheses in functions is to bundle together smaller objects into a larger, more complex, instance of an anonymous class.
In turn, one of the advantages to using parentheses () to create anonymous classes is so that we can use in-fix lexors/tokenizers instead of a pre-fix lexors, tokenizers, and/or parsers.
pow(base, exp) is not a pre-fix function applied to two inputs.
Rather, pow is the left-most argument to the anonymous in-fix operator.
anonymous in-fix operator
├─ pow
├─ instance of an anonymous class (base, exp)
│  ├─ base
│  ├─ exp

When studying arithmetic, children learn that (10)(5) = 10*5.
The product of 10 and 5 need not have a multiplication sign explicitly written.
Likewise, 10y is the same thing as 10 × y

Instead of parsing characters, I recommend parsing transitions between characters.

pow(base, exp)




transition from character to character
description




po
transition from p to o


ow
transition from o to w


w(
transition from w to (


(b
transition from ( to b


ba
transition from b to a




Transitioning from w to ( should create a token for the implicit multiplication operator, or perhaps, we might call it the anonymous infix operator.
> **Comments:**
> **username_5** (2023-10-14): *"pow is the left-most argument to the anonymous in-fix operator."* - `pow` represents a function pointer. I wouldn't necessarily conceive the call operator as an "anonymous infix operator". In most languages, the call operator effectively has a compound syntax (that can't be broken down further into elements), with the left bracket separating the first two operands, commas separating further operands, and the right bracket unambiguously terminating the list of operands on the right (including coping with the case of calling a niladic function, where there is only one operand to the operator).  
> **username_6** (2023-10-14): I don't get what this is supposed to say. It seems to be rather about *semantic* interpretation of function calls, not necessarily of its *syntax*. For many parts it is hard to tell what is intended to be *your own* view as opposed to that of *(developers) of many programming languages*. Please consider to [edit] for clarity.  
> **username_7** (2023-10-14): "Anonymous class objects are not very popular" this is false: most languages that are object oriented also have anonymous class syntax. "Anonymous functions are very popular in **some** programming languages" also false. Most widely used languages these days (except C) have anonymous function syntax.  
> **username_8** (2023-10-14): I really like this approach for handling `()`, it's one I plan on going with for a future language I'm making (mainly since it means function calls with anonymous structs are a convenient way to do named arguments). But I don't think it this is the reason most, if any, existing languages have for this syntax.  
> **username_4** (2023-10-16): @Steve The transition from alpha-numeric characters to non-alphanumeric characters `w(b` inside of the string of text `pow(base, exp)` will eventually resolve to be the call-operator. However, consider `3(1 + 2)` and `(3)(1) + 2` and `10(x + y)` when the string of text located to the left of the parentheses is numbers only, such as `10`, then the anonymous infix operator will resolve to multiplication operator for float, integers, or other numeric data-types.  
> **username_4** (2023-10-16): @Steve The anonymous infix operator only resolves into the call-operator when the left-most token is associated with a function, method, functor, or other callable object.  
> **username_4** (2023-10-16): @MisterMiyagi Suppose that `F` is a function. Some programming languages, such as Java, C++, and Python, might appear to be a mixture of (1 infix notation `xFy`) and (2 prefix notation `Fxy`). For example, `1 + 2` is written in infix notation, but `mkdir()` is written in prefix notation. I think that it helps to view the whole thing as infix notation. In the mathematical expression, `10(y+z)` the multiplication sign is missing. Likewise, an infix symbol for the function-call operator is absent from the string `mkdir()`. It helps to think of a function being multiplied against its input args.  
> **username_4** (2023-10-16): @MisterMiyagi Note that `10(y + z)` is `10*(y + z)` where the asterisk `*` represents multiplication of `int`s and/or integer privatives, also known as whole numbers 1, 2, .... 912, etc... Likewise in the expression `mkdir()` we might have `mkdir*()`. That is, when no infix operator is written, we can imagine an invisible, hidden infix operator. This hidden infix operator might be nameless, or anonymous, just as anonymous functions are functions which have the potential to have no explicit label or name.  
> **username_4** (2023-10-16): @MisterMiyagi Suppose that `CALL` is the name we use for the operator which causes a function to be called or invoked. Then `CALL` takes two arguments: a function and a container of arguments. The parentheses `()` serve to create a single container of many arguments. Perhaps `CALL` cannot accept 3 input arguments, or 4 input arguments. If `CALL` is binary, then the arguments must be glued together to form one single object.  
> **username_5** (2023-10-16): @SamuelMuldoon, in programming, I'd reckon that multiplication isn't important enough to be given its own special syntax based on juxtaposition (i.e. the "anonymous infix operator").  
> **username_6** (2023-10-16): @SamuelMuldoon All those are reasons why *a developer might* want to use `function(arg1, arg2, ...)` syntax – notably not binding ones, as the semantics you describe aren't how many languages treat things and there are several languages that show it can be done completely differently. I don't see how those are reasons that *many specific, existing languages* have chosen to use that syntax. In fact, the intro of this answer ("this newer model for programming languages and is not a popular model at the time of my writing") suggests these consideration *aren't* why the syntax is commonly used.  
> **username_9** (2023-10-16): What you call an “anonymous class object” is present in many modern languages and usually called a *tuple*. A few programming languages have functions systematically take a tuple as a single argument, notably Standard ML. (Many ML-like languages also have functions take a single argument, but they favor currying for multiple arguments.) Lisp, one of the oldest programming languages, also has arguments packed into a single data structure; in Lisp, that's a list, because Lisp is built around lists. But most languages don't do that because packing arguments transparently just isn't that useful.  
---
