Description #
Hy is a Lisp dialect that transforms into Python’s Abstract Syntax Tree (AST), enabling developers to write Lisp-style code that runs directly in the Python ecosystem.
History #
Hy was created by Paul Tagliamonte in 2013. It was inspired by Clojure’s success and designed to bring Lisp’s macro power to Python programmers. Hy offers seamless Python interoperability while using fully parenthesized Lisp syntax.
Hello World Code #
(print "Hello, World!")
How to Run #
Option 1: Online
https://replit.com/languages/hy
Option 2: Local
Install via pip:
pip install hy
Run REPL:
hy
Or save to file:
(print "Hello, World!")
Then run:
hy hello.hy
Key Concepts #
- Lisp syntax with Python semantics
- Compiles to Python AST, runs on CPython
- Seamless access to Python libraries and objects
- Supports macros and metaprogramming
- Dynamically typed and interpreted
- REPL support for interactive development
- Strong community support for Pythonic-Lisp hybrids
- Encourages functional programming
- Extensible via standard Python tools
- Uses parentheses and prefix notation typical of Lisp
Try It Online #
https://replit.com/languages/hy
Fun Facts #
- Hy lets you write
defn
,lambda
, and macros while importing and using standard Python modules. - It’s sometimes described as “Lisp-flavored Python.”
- Great for Lisp users who want to work within Python’s ecosystem without abandoning their favorite syntax.