25 lines
624 B
Go
25 lines
624 B
Go
package registry
|
|
|
|
// A Expr is a lambda calculus expression. It can have any type of
|
|
// Expresentation, so long as that class is known to the registry it is handled
|
|
// by.
|
|
type Expr interface {
|
|
// Repr returns the name of the underlying Expresentation. It is assumed if
|
|
// two expressions have the same Repr(), they have the same Expresentation.
|
|
Repr() string
|
|
|
|
// The base expression data.
|
|
Data() any
|
|
}
|
|
|
|
type baseExpr struct {
|
|
id string
|
|
data any
|
|
}
|
|
|
|
func (r baseExpr) Repr() string { return r.id }
|
|
|
|
func (r baseExpr) Data() any { return r.data }
|
|
|
|
func NewExpr(id string, data any) Expr { return baseExpr{id, data} }
|