Hy Was
   HOME

TheInfoList



OR:

Hy is a
dialect The term dialect (from Latin , , from the Ancient Greek word , 'discourse', from , 'through' and , 'I speak') can refer to either of two distinctly different types of linguistic phenomena: One usage refers to a variety of a language that is a ...
of the Lisp
programming language A programming language is a system of notation for writing computer programs. Most programming languages are text-based formal languages, but they may also be graphical. They are a kind of computer language. The description of a programming ...
designed to interact with
Python Python may refer to: Snakes * Pythonidae, a family of nonvenomous snakes found in Africa, Asia, and Australia ** ''Python'' (genus), a genus of Pythonidae found in Africa and Asia * Python (mythology), a mythical serpent Computing * Python (pro ...
by translating
s-expression In computer programming, an S-expression (or symbolic expression, abbreviated as sexpr or sexp) is an expression in a like-named notation for nested list (tree-structured) data. S-expressions were invented for and popularized by the programming la ...
s into Python's
abstract syntax tree In computer science, an abstract syntax tree (AST), or just syntax tree, is a tree representation of the abstract syntactic structure of text (often source code) written in a formal language. Each node of the tree denotes a construct occurr ...
(AST). Hy was introduced at
Python Conference The Python Conference (also called PyCon) is the largestpage 10 annual convention for the discussion and promotion of the Python programming language. It originated in the United States but is also held in more than 40 other countries. It was one ...
(PyCon) 2013 by Paul Tagliamonte. Lisp allows operating on code as data (
metaprogramming Metaprogramming is a programming technique in which computer programs have the ability to treat other programs as their data. It means that a program can be designed to read, generate, analyze or transform other programs, and even modify itself ...
), thus Hy can be used to write domain-specific languages. Similar to Kawa's and
Clojure Clojure (, like ''closure'') is a dynamic and functional dialect of the Lisp programming language on the Java platform. Like other Lisp dialects, Clojure treats code as data and has a Lisp macro system. The current development process is comm ...
's mappings onto the Java virtual machine (JVM), Hy is meant to operate as a transparent Lisp front-end for Python. It allows Python
libraries A library is a collection of Document, materials, books or media that are accessible for use and not just for display purposes. A library provides physical (hard copies) or electronic media, digital access (soft copies) materials, and may be a ...
, including the standard library, to be imported and accessed alongside Hy code with a
compiling In computing, a compiler is a computer program that translates computer code written in one programming language (the ''source'' language) into another language (the ''target'' language). The name "compiler" is primarily used for programs that ...
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 PyPy () is an implementation of the Python programming language. PyPy often runs faster than the standard implementation CPython because PyPy uses a just-in-time compiler. Most Python code runs well on PyPy except for code that depends on CPyth ...
.


Example code

From the language documentation: => (print "Hy!") Hy! => (defn salutationsnm
ame #REDIRECT AME {{redirect category shell, {{R from other capitalisation{{R from ambiguous page ...
(print (+ "Hy " name "!"))) => (salutationsnm "YourName") Hy YourName!


See also

* Common Lisp *
Clojure Clojure (, like ''closure'') is a dynamic and functional dialect of the Lisp programming language on the Java platform. Like other Lisp dialects, Clojure treats code as data and has a Lisp macro system. The current development process is comm ...
*
Kawa (Scheme implementation) Kawa is a language framework written in the programming language Java that implements the programming language Scheme, a dialect of Lisp, and can be used to implement other languages to run on the Java virtual machine (JVM). It is a part of the GN ...
* 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