master > master: codego - generics

This commit is contained in:
RD
2021-05-15 10:58:17 +02:00
parent b315e666b8
commit 0856bfc0b0
3 changed files with 21 additions and 21 deletions

View File

@@ -11,6 +11,7 @@ import (
type Formula struct {
kind string
name string
expr string
valence int
subformulae [](*Formula)
@@ -28,6 +29,8 @@ func (fml *Formula) SetExpr(expr string) { fml.expr = expr }
func (fml Formula) GetExpr() string { return fml.expr }
func (fml Formula) GetName() string { return fml.name }
func (fml *Formula) SetSubformulae(subfmls [](*Formula)) {
fml.subformulae = subfmls
fml.valence = len(subfmls)

View File

@@ -22,23 +22,25 @@ var Contradiction = Formula{
* METHODS: Constructions
* ---------------------------------------------------------------- */
func Atom(expr string) Formula {
func Atom(name string) Formula {
return Formula{
kind: "atom",
expr: expr,
name: name,
expr: name,
valence: 0,
subformulae: [](*Formula){},
}
}
func NegatedAtom(expr string) Formula {
return Negation(Atom(expr))
func NegatedAtom(name string) Formula {
return Negation(Atom(name))
}
func Generic(expr string) Formula {
func Generic(name string) Formula {
return Formula{
kind: "generic",
expr: expr,
name: name,
expr: "{" + name + "}",
valence: 0,
subformulae: [](*Formula){},
}