
Hy: A Dialect of Clojure Embedded in Python - asimjalis
http://docs.hylang.org/en/stable/quickstart.html
======
djhaskin987
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.

------
foobar_
Hy is beautifully imperative. For people put off by functional programming Hy
is absolutely awesome.

The return/if/while/break/continue actually work without making you jump
through hoops.

------
polityagent
This is not a dialect of clojure, please fix the title.

~~~
jhbadger
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?

~~~
polityagent
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.

------
ivan_ah
This is very nice. I wonder if all the examples from SICP will run in Hy?

The tutorial is very well written and show all the language features:
[http://docs.hylang.org/en/stable/tutorial.html](http://docs.hylang.org/en/stable/tutorial.html)

Funny quote from the quickstart:

    
    
       #! /usr/bin/env hy
       (print "I was going to code in Python syntax, but then I got Hy.")

------
js2
This has shown up on HN a few times but the only significant discussion seems
to be from 2014.

[https://news.ycombinator.com/item?id=8696975](https://news.ycombinator.com/item?id=8696975)

~~~
js2
Actually
[https://news.ycombinator.com/item?id=14909786](https://news.ycombinator.com/item?id=14909786)

[https://hn.algolia.com/?query=Hy%20lisp%20points%3E10&sort=b...](https://hn.algolia.com/?query=Hy%20lisp%20points%3E10&sort=byDate&dateRange=all&type=story&storyText=false&prefix=false&page=0)

------
S4M
I like the concept of Hy, but has anyone used it for something "serious"?

~~~
HelloNurse
In other words, apart from parenthetical syntax, what value does it add over
just writing Python? For example, what macros are useful "in the wild"?

~~~
S4M
The canonical example of macro that is useful "in the wild" is embedding SQL
in your code. See for example [http://www.gigamonkeys.com/book/practical-an-
mp3-database.ht...](http://www.gigamonkeys.com/book/practical-an-
mp3-database.html)

(Disclosure: I am just an occasional LISP dabbler)

------
asimjalis
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.

