51
submitted 1 year ago* (last edited 1 year ago) by aldalire@lemmy.dbzer0.com to c/chapotraphouse@hexbear.net

Seriously. There’s so many floating around. It feels like there’s a cycle of

Random programmer thinks xyz language sucks -> she/he makes a slightly different, slightly faster, slightly more secure version -> by luck this gains mass adoption-> random programmer thinks new xyz language sucks

I propose when the revolution comes and the last guillotine falls we decide a general-purpose programming language that coders should stick to. I vote Lisp or any of the dialects (scheme, clojure, racket), but i also feel something about the Julia language for scientific research. Maybe we can decriminalize using C. Absolutely ban and hunt down the use of any of the hipster languages teenagers are into these days.

Nim? Zig? Crystal?? I am absolutely losing my damn mind. It compiles to bytecode people. Make up ur damn minds. To jail with all of u

you are viewing a single comment's thread
view the rest of the comments
[-] TrashGoblin@hexbear.net 2 points 1 year ago

Unless you are writing a hard-realtume system, Common Lisp is the only language you will ever need.

[-] space_comrade@hexbear.net 4 points 1 year ago* (last edited 1 year ago)

Be quiet parentheses diddler, (((((()((((((())((do-thing (())(())))))0((( who the fuck wants to look at that all day.

But seriously tho how do you get used to the syntax? I've read some moderately complex Lisp code and it was very hard to read for me, do you just kinda get used to it over time or is there extra tooling involved?

[-] aldalire@lemmy.dbzer0.com 3 points 1 year ago* (last edited 1 year ago)

OK fair point actually. You just gotta write some lisp code yourself (I'm a fairly new lisper although I had emacs for a while now and have dabbled in some elisp to edit my config) to appreciate how the parentheses are actually helpful when you write things. To read things, well-written lisp code will be properly indented, or else a reasonably powerful editor (emacs with sly, etc) is able to indent the code for you

Take a look at my (shameless plug) eratosthenes sieve function i wrote just yesterday

(defun range (start end)
  (if (< start end)
      (cons start (range (1+ start) end))))

;; Checks if d is a factor of n
(defun factorofp (d n)
  (zerop (rem n d)))

;; Sieve in lisp??
(defun sieve (n)
  (let ((primes (range 2 n))
        (curprime 2))
    (maplist (lambda (tail)
               (delete-if (lambda (n)
                            (factorofp curprime n))
                          (cdr tail))
               (setf curprime (cadr tail)))
             primes)
    primes))

u don't have to understand it. But the general principle is, things that are indented at the same level are arguments to the same function. In other words, notice that the delete-if and the setf are indented together. So they must be part of the same "argument:" namely, the body of the anonymous function lambda. So really, you don't have to count the parentheses or anything. The indentation makes things clear and unambiguous.

Other things that aid in reading are, obviously, patterns that you pick up along the way. Do not fear the parentheses. Embrace them

[-] space_comrade@hexbear.net 4 points 1 year ago

I can read it if I really focus but even with the nice indentation the syntax doesn't make it easy, it's probably way easier with proper syntax highlighting tho, whatever the Lemmy renderer did here seems wrong.

I still don't really see why I would suffer the syntax over using a more readable language, I've heard this syntax makes the macro system way more elegant/powerful but I can't see it being THAT much better than whatever other languages are doing.

[-] TrashGoblin@hexbear.net 1 points 1 year ago

So, you do get used to it. The parentheses aren't any more distracting or pervasive than the mix of parentheses and brackets in C-like languages, they're just more uniform. The big syntax difference is that there are no infix operators, only functions.

So, the macro systems in Lisp and its cousins actually are a lot more powerful than text-manipulating macro systems like C. The reason is that without infix operators, and with the syntax being so regular, the structure of the source code is identical to the code's abstract syntax tree. So your macros can effectively manipulate the AST rather than the not-yet-parsed source code. But I don't even really write macros very often, and I still appreciate the consistent syntax compared to the complexity of something like Rust.

this post was submitted on 27 Mar 2024
51 points (100.0% liked)

chapotraphouse

13958 readers
783 users here now

Banned? DM Wmill to appeal.

No anti-nautilism posts. See: Eco-fascism Primer

Slop posts go in c/slop. Don't post low-hanging fruit here.

founded 4 years ago
MODERATORS