Skip to content

Do I mark a function as Changed so that its reevaluated and not cached in Rete Algorithm #301

Answered by newm4n
shreyaspurohit asked this question in Q&A
Discussion options

You must be logged in to vote

Hi @shreyaspurohit ,
Yes, that's how you do it.

Looking at the logic of Reset function in WorkingMemory.go

// Reset will reset the evaluated status of a specific variable if its contains a variable name in its signature.
// Returns true if any expression was reset, false if otherwise
func (e *WorkingMemory) Reset(name string) bool {
	AstLog.Tracef("------- resetting  %s", name)
	for _, vari := range e.variableSnapshotMap {
		if vari.GrlText == name {
			return e.ResetVariable(vari)
		}
	}
	for snap, expr := range e.expressionSnapshotMap {
		if strings.Contains(snap, name) || strings.Contains(expr.GrlText, name) {
			expr.Evaluated = false
		}
	}
	for snap, expr := range e.expressionAtomSn…

Replies: 2 comments

Comment options

You must be logged in to vote
0 replies
Answer selected by shreyaspurohit
Comment options

You must be logged in to vote
0 replies
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
None yet
2 participants