7 ms·
I know a lot of people think that you write more parentheses in Lispy languages, but actually in most cases you just type them in a different order, e.g. instea
by phforms 2y ago
I know a lot of people think that you write more parentheses in Lispy languages, but actually in most cases you just type them in a different order, e.g. instead of `foo(x, y)` to call a function, you type `(foo x y)` and you even save a comma.
Of course, there are constructs such as `let` and `cond` that are more parenthetically noisy (not so much in Clojure though), but on the flip side you don’t have to remember a lot of special syntax like in non-lisp languages.
Most Lisp-people also use structural editing tools like paredit[1], which make it really easy to write and edit s-expressions. I found that after some time I didn’t really think that much about parentheses anymore.
[1]: https://paredit.org https://paredit.org
- alabhyajindal 2y agoYou're right about the order part and I didn't consider it initially. This is what Fizzbuzz looks like in Clojure: (defn fizzbuzz [n] (cond (zero? (rem n 15)) "FizzBuzz" (zero? (rem n 3)) "Fizz" (zero? (rem n 5)) "Buzz" :else (str n))) (defn print-fizzbuzz [n] (doseq [i (range 1 (inc n))] (println (fizzbuzz i)))) This looks overwhelming for someone who hasn't written any Lisp. My thought looking at this code was that I have to type a parenthesis before formulating any thought. Which is crazy because it's not some huge thing. It's like saying I have to press Enter before writing a line of Python.