News for hackers. Stuff that matters.
Re:Hy 1.0.0, the Lisp dialect for Python, has been released by notepad0x90 on Monday September 23, 2024 @09:35PM (#41632329)
Because we're so used to thinking parenthesis provides an order of evaluation precedence, the fact that 'fn' is within the parenthesis is very confusing. even (fn(x y z)) would have been better. having the function name and it's arguments just next to each other with no syntactic separation is hard to follow. it's like doing arithmetic this way: "add x y z" , is it x+y = z or x=y+z? I'm sure I can get over this hurdle though.

Thanks for suggesting paredit.

Re:Hy 1.0.0, the Lisp dialect for Python, has been released by troad on Monday September 23, 2024 @10:59PM (#41632731)
I hear you. Try to shift your thinking from statements to expressions, it will make things easier.

The parentheses enclose expressions, and the hierarchy of expressions builds a tree. This tree, in effect, is your program's AST.

"Add x y z" is exactly what it sounds like, if I said those words to you. The add function is usually +, so (+ x y z) is an expression that adds x, y and z, and the whole expression evaluates to the result. You can nest expressions however you like, so, for example, (+ x (* a b)) adds x to the result of the expression (* a b), which evaluates to the result of multiplying a by b.

You can put arbitrarily powerful code inside an expression, and you can use an expression absolutely everywhere you can use a value. Any one of +, x, or y, could be replaced by an arbitrarily complex expression (yes, the function too - you could replace it with a call to a higher order function, which would return a function that is then called over x and y).

The neat thing is, that's basically[0] all the syntax Lisp has. There are no reserved keywords. There's no magic to math or control flow, they all work as per above, and can all be redefined at will. You can make + subtract. You can change the language's if and else to work any way you want. You can redefine Lisp's reader to change the syntax of the language to absolutely anything you like. And you can do all of this in a running REPL without even needing to restart it. That's the power of a Lisp.

If you're interested, read Common Lisp: A Gentle Introduction to Symbolic Computation by David S. Touretzky.

[0] Macros are the other piece of the puzzle, but to understand them you would need to read up on Lisp more.

Re:Hy 1.0.0, the Lisp dialect for Python, has been released by notepad0x90 on Tuesday September 24, 2024 @01:25AM (#41633323)
Wow, thanks very much for the detailed reply. I'm a bit excited and interested to read up on it more. I can only imagine, it must have inspired so many enthusiast level and esoteric languages.