← Back to context

Comment by skydhash

12 days ago

> these fucking parenthesis are ridiculous

They're just different. And once you've come familiar with the language, you miss s-expressions everyday, because they're just that easy to work with, especially with something like paredit. Why? because the grammar is easy to parse and reason about. The whole code is a tree. And evaluation is mostly working from the leaves to the root.

> "car" and "cons", yeey, but "first" would have been so hard?

It comes from the nature of the language. "cons" is to construct a pair of values, and "car" to get the first one, while "cdr" returns the second one. But lists are composed of cons cells (check how it works), and in that case you could argue for "head" and "tail" for the function names. But "car" and "cdr" were first and you could alias them easily.

> no return, so sometimes something just takes the last one and returns

The computing paradigm is expression evaluations, not sequence of instructions (although sequencing is there). An s-expression is always equivalent to something, and that something is what you're computing. Something like (first '("name" "email")) is the same as "name". Or (if (> x 0) :pos :neg) with x = 5 is the same as (if t :pos :neg) and the same as :pos. [0]

No return is needed. It's tricky when doing iteration, but whenever you're doing sequencing (they mention that in the docs for CL), the last value is equivalent to the whole thing.

[0]: https://en.wikipedia.org/wiki/Lambda_calculus#Reduction

other ASTs are trees too :)

> It's tricky when doing iteration ...

and that's my problem, that in the name of simplicity everything nice is thrown out. and "don't even think about it" and "you are holding it wrong" is the official motto. sure, I'm happy to adapt if I feel I got something in return, ie. memory safety with Rust, powerful type system in Scala, etc.

all in all, sure, it's Turing-complete, and obviously millions of people already grok it and are productive in Lisps, but to me - and apparently to the vast majority of programmers - it's too foreign.

  • > I'm happy to adapt if I feel I got something in return

    Lisp is not a silver bullet. Whatever you can do with lisp, you can do with C or with JavaScript. What's different is how you do it. And it turns out that it's easier to create elegant solutions in Lisp as the mental model is heavily based on mathematics (lambda calculus). It's a different models of computing and solutions you're used to may no longer applied. Instead you reach out to a new way of solving the problem.

    When I say iteration is tricky, it's that most of the time, you relying on some mutable state to do the looping (i counter) and early termination, but in CL and Clojure, there often are easier ways.

    I'd recommend learning about computing models. Some solutions are easier to solve in one than the others. And now computers are powerful enough that we don't have to worry about performance (that often) and we can focus on creating better programs.

  • > memory safety with Rust, powerful type system in Scala

    ... easy and seamless user-defined compiler extensions with lisp