summaryrefslogtreecommitdiff
path: root/content/posts/languages-that-do-not-use-prefix-notation-are-weird
diff options
context:
space:
mode:
Diffstat (limited to 'content/posts/languages-that-do-not-use-prefix-notation-are-weird')
-rw-r--r--content/posts/languages-that-do-not-use-prefix-notation-are-weird/index.md14
1 files changed, 7 insertions, 7 deletions
diff --git a/content/posts/languages-that-do-not-use-prefix-notation-are-weird/index.md b/content/posts/languages-that-do-not-use-prefix-notation-are-weird/index.md
index 99172b2..b56df30 100644
--- a/content/posts/languages-that-do-not-use-prefix-notation-are-weird/index.md
+++ b/content/posts/languages-that-do-not-use-prefix-notation-are-weird/index.md
@@ -12,7 +12,6 @@ I don't mean that you should avoid such languages, but rather that they are exce
For some reason, prefix notation is often associated with Lisp.
In reality, there are very few languages that do _not_ use prefix notation.
Off the top of my head, I can only think of Forth, and Postscript.
-
Consider the following:
```c
@@ -24,8 +23,7 @@ Well, it could be C, C++, Java, Javascript, Python, C#...
Great.
That looks like a normal procedure call.
-It could be one of many languages, assuming this is not a complete statement (missing a semicolon in some languages).
-
+It could be one of many languages, assuming this is not a complete statement (as it would be missing a semicolon in some languages).
Now, what if we remove the useless comma:
```c
@@ -38,7 +36,7 @@ And let's get a little crazy, and move the opening parenthesis to the begining o
(foo a b)
```
-Now what language do we have?
+What language do we have now?
Well, it could be Common Lisp, Clojure, Elisp, Scheme...
Generally, it is some dialect of Lisp.
@@ -47,11 +45,13 @@ We moved it nowhere.
The only reason that prefix notation is associated with Lisp, is because most other languages have a few inconsistencies.
Namely, arithmetic operators like `+`, `-`, `*`, and `/`.
-_These_ operators are usually given an _infix_ syntax, and it is placed between its operands: `a + b`.
+These operators are usually treated in a special way, and given an infix syntax; they are placed between its operands: `a + b`.
In most programming domains, the vast majority of operations are procedure calls - not arithmetic operations.
+The importance of these operators are blown out of proportion because of how familiar they are.
+In practice using a function-like notation for them is not a big deal.
-Lisp does not have this inconsistency.
-The operator is always placed before any operands.
+The operator is always placed before any operands in Lisp.
+It does not represent any operators in a special and inconsistent way.
Expressions like `(+ a b)` may look strange at first, but just consider: `+` is simply the chosen name for the `add` procedure.
If we use the name `add` instead, we get: