Paradigm | Multi-paradigm: procedural, functional, object-oriented, meta, reflective, generic |
---|---|
Family | Lisp |
Designed by | Paul Tagliamonte |
Developers | Core team |
First appeared | 2013 |
Stable release | |
Scope | lexical, optionally dynamic[ citation needed ] |
Platform | IA-32, x86-64 |
OS | Cross-platform |
License | MIT-style |
Filename extensions | .hy |
Website | hylang |
Influenced by | |
Kawa, Clojure, Common Lisp |
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 [note 1] step where both languages are converted into Python's AST. [note 2] [9] [10] [11]
From the language documentation: [12]
=>(print"Hy!")Hy!=>(defn salutationsnm[name](print(+"Hy "name"!")))=>(salutationsnm"YourName")HyYourName!
In computer science, functional programming is a programming paradigm where programs are constructed by applying and composing functions. It is a declarative programming paradigm in which function definitions are trees of expressions that map values to other values, rather than a sequence of imperative statements which update the running state of the program.
Lisp is a family of programming languages with a long history and a distinctive, fully parenthesized prefix notation. Originally specified in the late 1950s, it is the second-oldest high-level programming language still in common use, after Fortran. Lisp has changed since its early days, and many dialects have existed over its history. Today, the best-known general-purpose Lisp dialects are Common Lisp, Scheme, Racket, and Clojure.
Python is a high-level, general-purpose programming language. Its design philosophy emphasizes code readability with the use of significant indentation.
Programming languages can be grouped by the number and types of paradigms supported.
Metaprogramming is a computer 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, analyse, or transform other programs, and even modify itself, while running. In some cases, this allows programmers to minimize the number of lines of code to express a solution, in turn reducing development time. It also allows programs more flexibility to efficiently handle new situations with no recompiling.
In some programming languages, eval
, short for the English evaluate, is a function which evaluates a string as though it were an expression in the language, and returns a result; in others, it executes multiple lines of code as though they had been included instead of the line including the eval
. The input to eval
is not necessarily a string; it may be structured representation of code, such as an abstract syntax tree, or of special type such as code
. The analog for a statement is exec, which executes a string as if it were a statement; in some languages, such as Python, both are present, while in other languages only one of either eval
or exec
is.
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 CPython extensions, which either does not work or incurs some overhead when run in PyPy.
A foreign function interface (FFI) is a mechanism by which a program written in one programming language can call routines or make use of services written or compiled in another one. An FFI is often used in contexts where calls are made into a binary dynamic-link library.
In programming, a docstring is a string literal specified in source code that is used, like a comment, to document a specific segment of code. Unlike conventional source code comments, or even specifically formatted comments like docblocks, docstrings are not stripped from the source tree when it is parsed and are retained throughout the runtime of the program. This allows the programmer to inspect these comments at run time, for instance as an interactive help system, or as metadata.
In functional programming, filter is a higher-order function that processes a data structure in some order to produce a new data structure containing exactly those elements of the original data structure for which a given predicate returns the boolean value true
.
libffi is a foreign function interface library. It provides a C programming language interface for calling natively compiled functions given information about the target function at run time instead of compile time. It also implements the opposite functionality: libffi can produce a pointer to a function that can accept and decode any combination of arguments defined at run time.
Clojure is a dynamic and functional dialect of the Lisp programming language on the Java platform.
Elixir is a functional, concurrent, high-level general-purpose programming language that runs on the BEAM virtual machine, which is also used to implement the Erlang programming language. Elixir builds on top of Erlang and shares the same abstractions for building distributed, fault-tolerant applications. Elixir also provides tooling and an extensible design. The latter is supported by compile-time metaprogramming with macros and polymorphism via protocols.
Julia is a high-level, general-purpose dynamic programming language, most commonly used for numerical analysis and computational science. Distinctive aspects of Julia's design include a type system with parametric polymorphism and the use of multiple dispatch as a core programming paradigm, efficient garbage collection, and a just-in-time (JIT) compiler. Notably Julia does not support classes with encapsulated methods and instead it relies on structs with separate functions.
In computer science, the expression code as data refers to the idea that source code written in a programming language can be manipulated as data, such as a sequence of characters or an abstract syntax tree (AST), and it has an execution semantics only in the context of a given compiler or interpreter. The notion is often used in the context of Lisp-like languages that use S-expressions as their main syntax, as writing programs using nested lists of symbols makes the interpretation of the program as an AST quite transparent.
In computer programming, self-hosting is the use of a program as part of the toolchain or operating system that produces new versions of that same program—for example, a compiler that can compile its own source code. Self-hosting software is commonplace on personal computers and larger systems. Other programs that are typically self-hosting include kernels, assemblers, command-line interpreters and revision control software.
In computer science, interning is re-using objects of equal value on-demand instead of creating new objects. This creational pattern is frequently used for numbers and strings in different programming languages. In many object-oriented languages such as Python, even primitive types such as integer numbers are objects. To avoid the overhead of constructing a large number of integer objects, these objects get reused through interning.
1958 | 1960 | 1965 | 1970 | 1975 | 1980 | 1985 | 1990 | 1995 | 2000 | 2005 | 2010 | 2015 | 2020 | ||
---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
LISP 1, 1.5, LISP 2(abandoned) | |||||||||||||||
Maclisp | |||||||||||||||
Interlisp | |||||||||||||||
MDL | |||||||||||||||
Lisp Machine Lisp | |||||||||||||||
Scheme | R5RS | R6RS | R7RS small | ||||||||||||
NIL | |||||||||||||||
ZIL (Zork Implementation Language) | |||||||||||||||
Franz Lisp | |||||||||||||||
Common Lisp | ANSI standard | ||||||||||||||
Le Lisp | |||||||||||||||
MIT Scheme | |||||||||||||||
XLISP | |||||||||||||||
T | |||||||||||||||
Chez Scheme | |||||||||||||||
Emacs Lisp | |||||||||||||||
AutoLISP | |||||||||||||||
PicoLisp | |||||||||||||||
Gambit | |||||||||||||||
EuLisp | |||||||||||||||
ISLISP | |||||||||||||||
OpenLisp | |||||||||||||||
PLT Scheme | Racket | ||||||||||||||
newLISP | |||||||||||||||
GNU Guile | |||||||||||||||
Visual LISP | |||||||||||||||
Clojure | |||||||||||||||
Arc | |||||||||||||||
LFE | |||||||||||||||
Hy | |||||||||||||||
Chialisp |