News for hackers. Stuff that matters.
Re:How to store your app's entire state in the url by NavinF on Tuesday January 10, 2023 @02:55AM (#34321812)
Well yeah that's a major reason why most programmers hate LISP syntax. It uses a parentheses for everything even though every keyboard has round, square, angle and curly braces.
Re:How to store your app's entire state in the url by TeMPOraL on Tuesday January 10, 2023 @03:32AM (#34322034)
I somehow doubt it. I tutored quite a few people of all ages who started to learn programming, mostly C, C++ and Java - they all initially have been mostly confused by the different kinds of brackets. They quickly understood where the brackets go (scopes/blocks, function calls, array declarations and access, etc.), but took some time to internalize which bracket type is used in which context.

I suspect the main reason programmers dislike Lisp syntax is that they try or see an example of some basic arithmetics, get surprised by the prefix notation that's so "unnatural" compared to the "obvious" infix notation they learned in primary school, and write off the entire language as weird, not noticing the fact that infix math is an exception in programming languages, as otherwise almost all code they write in any other language is in prefix notation too, just with a parenthesis shifted to the left.

A somewhat mind-blowing observation to some people:

  (foo (bar baz quux))
  
  foo(bar(baz, quux));
The two lines above are both in prefix notation. You can go from the first to the second one by a) shifting each left paren by one token to the right, and b) adding commas between whitespace-separated tokens.
Re:How to store your app's entire state in the url by xmprt on Tuesday January 10, 2023 @03:58AM (#34322175)
I suppose beginner programmers might find all the different kinds of brackets in C++ confusing but after some experience, it helps a lot with readability. If I see `a[1]` then I know that `a` is probably an array. If I see `a(1)` then I know that `a` is probably a function. You could make the argument that those are terrible names for variables and methods and you'd be correct, but every small bit of context helps.
Re:How to store your app's entire state in the url by spullara on Sunday January 15, 2023 @10:26PM (#34396459)
Like most of the verbosity in those languages it benefits the reader more than the writer.
Re:How to store your app's entire state in the url by moonchrome on Tuesday January 10, 2023 @07:36AM (#34323901)
Clojure uses [] and {}, eg. :

  (defn fib [x, n]
    (if (< (count x) n) 
      (fib (conj x (+ (last x) (nth x (- (count x) 2)))) n)
      x))