ok so after graduation i have some free time, and i think i should learn something new. because i have no experience in functional programming i thought i should try it
my background is mainly python which is what i use the most
so i researched clojure (random example), and already i hate this illogical language. i mean what the fuck is the justification for putting the operator before the variables?
Lisp has very few primitives:
* Number: 42
* Symbol: hello
* String: "hello, world"
* Nil or ``empty list'': ()
Its only real data structure is a dotted pair (although some implementation have arrays/vectors). A pair can contain any two primitives.
* Pair: (42 . "hello, world")
The pair is made up of its car (first element) and cdr (second element).
Nil is an empty list: ()
A pair is called a list when its cdr is nil: (42 . ())
A pair is also a list when its cdr is another list: (42 . (hello . ("hello, world" . ())))
Since the syntax for consecutive dotted pairs is cumbersome, Lisp removes the dots and excessive parenthesis: (42 hello "hello, world")
In Lisp, code is data. A page of code in Lisp is really just a list that's evaluated by the interpreter. When a list evaluated by itself, it's usually treated as a function or macro call, with the first element being the function and the other elements being arguments. i.e. (f n) or (g x y).
Operators are really just functions. The + operator is really just an add function. You can think of (+ 24 42) as (add 24 42). Having (24 + 42) would add useless syntax rules to the core of Lisp, and there's really no reason why it should be expressed that way or shouldn't be expressed the way Lisp does. It's just a useless convention from a time before computers. In programming, we break those rules all the time:
x = 42
y = 24
x = y
As a programmer, that makes sense to you, but it wouldn't have made sense to Newton. Yet nobody complains about it.
add(x, y) = x + y
add(24, 42)
This would make perfect sense to Newton. It makes perfect sense mathematically. Therefore, there's nothing wrong with (add x y) or as the case may be, (+ x y). In my opinion it's a better convention than what they teach in grade school arithmetic. I don't know why people get so offended by it.