Term#
- class Term(*args, **kwargs)[source]#
Abstract base class for terms.
A term is an expression representing a value of a type.
It can be either a
Variable
,Constant
,Application
, orAbstraction
.
Variable#
Bound variable#
- class BoundVariable(arg1, type=None, **kwargs)[source]#
Bound variable.
(Internal: Not intended for direct use.)
Internally, terms use what is called a locally nameless representation. This is a combination of using De Bruijn indices for variables local to the current term (
BoundVariable
) and names for variables global to the current term (Variable
). See C. McBride and J. McKinna, “Functional Pearl: I am not a number–I am a free variable”, Haskell’04, 2004. ACM.See also
Term.open()
,Term.close()
.
Constant#
Application#
- class Application(arg1, arg2, *args, **kwargs)[source]#
Application.
An application is a compound expression representing the application of arg1 to arg2.
Application is left-associative: If more than two arguments are given, the result is left-folded.
- Parameters:
- Returns:
A new
Application
.- Raises:
ValueError – arg1 cannot be applied to arg2.