Top 1,000 Features Creators Events Podcasts Extensions Interviews Blog Explorer CSV

Hy

< >

Hy is an open source programming language created in 2013 by Paul Tagliamonte.

#146on PLDB 11Years Old 398Repos
Download source code:
git clone https://github.com/hylang/hy
Homepage · REPL · Try It Online · Source Code · Wikipedia · Docs

Hy (alternately, Hylang) is a programming language, a dialect of the language Lisp designed to interact with the language Python by translating expressions into Python's abstract syntax tree (AST). Hy was introduced at Python Conference (PyCon) 2013 by Paul Tagliamonte.Similar to Kawa's and Clojure's mapping of s-expressions onto the Java virtual machine (JVM), Hy is meant to operate as a transparent Lisp front end to Python's abstract syntax. Lisp allows operating on code as data (metaprogramming). Read more on Wikipedia...


Example from the web:
(+ "Hyllo " "World" "!")
Example from Riju:
(print "Hello, world!")
Example from hello-world:
(print "Hello World")
Example from Linguist:
;; Fibonacci example in Hy. (defn fib [n] (if (<= n 2) n (+ (fib (- n 1)) (fib (- n 2))))) (if (= __name__ "__main__") (for [x [1 2 3 4 5 6 7 8]] (print (fib x))))
Example from Wikipedia:
=> (print "Hy!") Hy! => (defn salutationsnm [name] (print (+ "Hy " name "!"))) => (salutationsnm "YourName") Hy YourName!

Language features

Feature Supported Example Token
MultiLine Comments
Integers
; -?\d+
Floats
; -?\d+\.\d+
Hexadecimals
; 0[xX][a-fA-F0-9]+
Octals
; 0[0-7]+j?
Strings
"Hello world"
"
Print() Debugging print
Comments
; A comment
Line Comments
; A comment
;
Semantic Indentation X

View source

- Build the next great programming language · About · Resources · Acknowledgements · Part of the World Wide Scroll