Пример #1
0
func (m Memory) Grow(valve tree.Name, age int, value tree.Meaning) Memory {
	return Memory(
		tree.Tree(m).Grow(
			valve,
			MemoryFunctional{
				"Valve": tree.Branch{valve},
				"Value": tree.Branch{value},
				"Age":   tree.Branch{age},
			},
		).Collapse(),
	)
}
Пример #2
0
func (s Sentence) Grow(time int, valve tree.Name, value tree.Meaning) Sentence {
	return Sentence(
		tree.Tree(s).Grow(
			time,
			SentenceFunctional{
				"Valve": tree.Branch{valve},
				"Value": tree.Branch{value},
				"Time":  tree.Branch{time},
			},
		).Collapse(),
	)
}
Пример #3
0
func materializeBuiltin(d see.Design) Reflex {
	switch t := d.(type) {
	case see.StringDesign:
		return NewNounReflex(string(t))
	case see.IntDesign:
		return NewNounReflex(int(t))
	case see.FloatDesign:
		return NewNounReflex(float64(t))
	case see.ComplexDesign:
		return NewNounReflex(complex128(t))
	case see.TreeDesign:
		return NewNounReflex(tree.Tree(t))
	}
	panic("unknown builting design")
}
Пример #4
0
func (mf MemoryFunctional) Age() int {
	return tree.Tree(mf).AtInt("Age")
}
Пример #5
0
func (mf MemoryFunctional) Value() tree.Meaning {
	return tree.Tree(mf).At("Value")
}
Пример #6
0
func (mf MemoryFunctional) Valve() tree.Name {
	return tree.Tree(mf).AtName("Valve")
}
Пример #7
0
func (m Memory) At(valve tree.Name) MemoryFunctional {
	return tree.Tree(m).At(valve).(MemoryFunctional)
}
Пример #8
0
func (sf SentenceFunctional) Time() int {
	return tree.Tree(sf).AtInt("Time")
}
Пример #9
0
func (sf SentenceFunctional) Value() tree.Meaning {
	return tree.Tree(sf).At("Value")
}
Пример #10
0
func (sf SentenceFunctional) Valve() tree.Name {
	return tree.Tree(sf).AtName("Valve")
}
Пример #11
0
func (s Sentence) At(time int) SentenceFunctional {
	return tree.Tree(s).At(time).(SentenceFunctional)
}
Пример #12
0
func (s Sentence) At(valve tree.Name) SentenceFunctional {
	return tree.Tree(s).At(valve).(SentenceFunctional)
}