Misleading title. In the first place the proper title is "Hy: Quickstart". In the second, Hy is nothing like clojure. It is a LISP like clojure is, true, but it doesn't have any of the libraries or even syntactic constructs of clojure, such as built-in maps.
It is a LISP built on CPython. That's cool, but it feels more like you're writing homoiconic python than clojure, down to the mutation-centric control flow and keywords.
The following function is valid in hy and clojure.
(defn fact [x] (if (< x 2) 1 (* x (fact (- x 1)))))
Yes, hy and clojure don't have access to the same libraries, but then neither do clojure and clojurescript, yet you'd agree that clojurescript is a dialect of clojure, yes?
It is a lisp, with visual similarities to clojure. Library access is irrelevant. The features that differentiate clojure are not there.
- Immutable and persistent data structures as the default
- Functional programming (no early returns or mutable bindings) as the default
- Reader literals for those data structures
- Concurrency primitives (including core.async)
- Protocols for polymorphism
From the hy docs: "Hy derives a lot from Clojure & Common Lisp, while always maintaining Python interoperability". Borrowing nice features where you find them is great, but it doesn't make it either a common lisp dialect or a clojure dialect. It just makes it a lisp with some similar stuff.
Clojure and Clojurescript DO have access to a lot of the same libraries.
There are also conditional reader constructs so that a library can, when necessary, offer different implementation details between Clojure and Clojurescript.
Ignoring libraries completely, Hy doesn't have the most important things that set Clojure apart. (As another poster points out.) Especially immutability.
This is nothing against Hy. I'm sure I would like it when I want a Lisp in a Python environment. But there's no good reason, and it is even misleading, to try to conflate it with clojure. It seems like it stands on its own strengths well enough.
It “feels” like Clojure for whatever that is worth. I find myself more naturally doing functional programming in Hy than in Python. The threading operators encourage this.
16 comments
[ 3.4 ms ] story [ 48.4 ms ] threadIt is a LISP built on CPython. That's cool, but it feels more like you're writing homoiconic python than clojure, down to the mutation-centric control flow and keywords.
https://news.ycombinator.com/item?id=8696975
https://hn.algolia.com/?query=Hy%20lisp%20points%3E10&sort=b...
(Disclosure: I am just an occasional LISP dabbler)
The return/if/while/break/continue actually work without making you jump through hoops.
(defn fact [x] (if (< x 2) 1 (* x (fact (- x 1)))))
Yes, hy and clojure don't have access to the same libraries, but then neither do clojure and clojurescript, yet you'd agree that clojurescript is a dialect of clojure, yes?
- Immutable and persistent data structures as the default
- Functional programming (no early returns or mutable bindings) as the default
- Reader literals for those data structures
- Concurrency primitives (including core.async)
- Protocols for polymorphism
From the hy docs: "Hy derives a lot from Clojure & Common Lisp, while always maintaining Python interoperability". Borrowing nice features where you find them is great, but it doesn't make it either a common lisp dialect or a clojure dialect. It just makes it a lisp with some similar stuff.
There are also conditional reader constructs so that a library can, when necessary, offer different implementation details between Clojure and Clojurescript.
Ignoring libraries completely, Hy doesn't have the most important things that set Clojure apart. (As another poster points out.) Especially immutability.
This is nothing against Hy. I'm sure I would like it when I want a Lisp in a Python environment. But there's no good reason, and it is even misleading, to try to conflate it with clojure. It seems like it stands on its own strengths well enough.
The tutorial is very well written and show all the language features: http://docs.hylang.org/en/stable/tutorial.html
Funny quote from the quickstart: