Example #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(),
	)
}
Example #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(),
	)
}
Example #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")
}
Example #4
0
func (mf MemoryFunctional) Age() int {
	return tree.Tree(mf).AtInt("Age")
}
Example #5
0
func (mf MemoryFunctional) Value() tree.Meaning {
	return tree.Tree(mf).At("Value")
}
Example #6
0
func (mf MemoryFunctional) Valve() tree.Name {
	return tree.Tree(mf).AtName("Valve")
}
Example #7
0
func (m Memory) At(valve tree.Name) MemoryFunctional {
	return tree.Tree(m).At(valve).(MemoryFunctional)
}
Example #8
0
func (sf SentenceFunctional) Time() int {
	return tree.Tree(sf).AtInt("Time")
}
Example #9
0
func (sf SentenceFunctional) Value() tree.Meaning {
	return tree.Tree(sf).At("Value")
}
Example #10
0
func (sf SentenceFunctional) Valve() tree.Name {
	return tree.Tree(sf).AtName("Valve")
}
Example #11
0
func (s Sentence) At(time int) SentenceFunctional {
	return tree.Tree(s).At(time).(SentenceFunctional)
}
func (s Sentence) At(valve tree.Name) SentenceFunctional {
	return tree.Tree(s).At(valve).(SentenceFunctional)
}