Hy is a
dialect
A dialect is a Variety (linguistics), variety of language spoken by a particular group of people. This may include dominant and standard language, standardized varieties as well as Vernacular language, vernacular, unwritten, or non-standardize ...
of the
Lisp
Lisp (historically LISP, an abbreviation of "list processing") is a family of programming languages with a long history and a distinctive, fully parenthesized Polish notation#Explanation, prefix notation.
Originally specified in the late 1950s, ...
programming language
A programming language is a system of notation for writing computer programs.
Programming languages are described in terms of their Syntax (programming languages), syntax (form) and semantics (computer science), semantics (meaning), usually def ...
designed to interact with
Python by translating
s-expressions into Python's
abstract syntax tree (AST). Hy was introduced at
Python Conference (PyCon) 2013 by Paul Tagliamonte. Lisp allows operating on code as data (
metaprogramming), thus Hy can be used to write
domain-specific languages.
Similar to
Kawa's and
Clojure's mappings onto the
Java virtual machine
A Java virtual machine (JVM) is a virtual machine that enables a computer to run Java programs as well as programs written in other languages that are also compiled to Java bytecode. The JVM is detailed by a specification that formally descr ...
(JVM), Hy is meant to operate as a transparent Lisp front-end for Python.
It allows Python
libraries, including the
standard library, to be imported and accessed alongside Hy code with a
compiling[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.] step where both languages are converted into Python's AST.
[Hy is tested on Python 2.7, 3.4 through 3.6, and PyPy.]
Example code
From the language documentation:
=> (print "Hy!")
Hy!
=> (defn salutationsnm ame(print (+ "Hy " name "!")))
=> (salutationsnm "YourName")
Hy YourName!
See also
*
Common Lisp
*
Clojure
*
Kawa (Scheme implementation)
*
CLPython
Notes
References
External links
*
*
Documentation
Video of 2014 PyCon talk
{{Lisp programming language
Lisp (programming language)
Cross-platform free software
Lisp programming language family
Programming languages created in 2013