Hy (programming language) explained
Hy is a dialect of the Lisp programming language designed to interact with Python by translating s-expressions into Python's abstract syntax tree (AST).[2] [3] Hy was introduced at Python Conference (PyCon) 2013 by Paul Tagliamonte.[4] Lisp allows operating on code as data (metaprogramming), thus Hy can be used to write domain-specific languages.[5]
Similar to Kawa's and Clojure's mappings onto the Java virtual machine (JVM),[6] [7] Hy is meant to operate as a transparent Lisp front-end for Python.[8] It allows Python libraries, including the standard library, to be imported and accessed alongside Hy code with a compiling[9] step where both languages are converted into Python's AST.[10] [11] [12] [13]
Example code
From the language documentation:[14] => (print "Hy!")Hy!=> (defn salutationsnm [name] (print (+ "Hy " name "!")))=> (salutationsnm "YourName")Hy YourName!
See also
Notes
- Web site: Hy 1.0a4. GitHub.
- Book: Jaworski. Michał. Expert Python programming. Ziadé. Tarek. Packt Publishing. 2019. 978-1-78980-677-9. Third. Birmingham, U.K.. 173. 1125343555.
- Book: Danjou, Julien. Serious Python: black-belt advice on deployment, scalability, testing, and more. No Starch Press. 2018. 9781593278793. San Francisco, CA. 145–149. 1057729260.
- PyCon lightning talk . Tagliamonte . Paul . 2 April 2013 . Santa Clara . 2 September 2014 . Python Conference (PyCon).
- Getting Hy on Python: How to implement a Lisp front-end to Python . Tagliamonte . Paul . 11 April 2014 . Montreal . 2 September 2014 . PyCon.
- News: Turto . Tuukka . Programming Can Be Fun with Hy . 2 September 2014 . . 14 February 2014.
- Book: Watson, Mark . A Lisp Programmer Living in Python-Land: The Hy Programming Language . LeanBooks . 2020.
- Web site: Edge . Jake . Getting Hy on Python . 2 September 2014 . 30 April 2014 . LWN.net.
- The term "compiled" may apply to expressing Hy code in Python's AST or converting that AST into bytecode, the latter being dependent on the specific Python interpreter used and not Hy.
- Hy is tested on Python 2.7, 3.4 through 3.6, and PyPy.
- Web site: Hy Documentation . hylang.org . 3 September 2014.
- Book: Danjou, Julien . 26 March 2014 . The Hacker's Guide to Python . https://books.google.com/books?id=B6nhAwAAQBAJ&pg=PT171 . The AST . 165–172.
- Web site: Kitchin . John . More on Hy and why I think it is a big deal . The Kitchin Research Group . . 19 September 2018 . 31 March 2016.
- Web site: Quickstart . Hylang.org . 19 September 2018 . 15 May 2018.
External links