From OpenCog

The FormulaStream is a kind of Value that holds a numeric formula within it. Whenever it is polled for it's current numeric value, that formula is automatically executed to obtain those numbers. Functionally, it always returns a FloatValue as the result. FormulaStreams are used to implement arithmetic on dynamically-changing values.

The FormulaTruthValue is a special case that returns SimpleTruthValues (which are vectors of length two).


The following defines a FormulaStream that computes a new FloatValue based on the FloatValues on (Concept "foo") located at the key (Predicate "some key"). Basically, it just takes whatever FloatValue can be found there, and adds ten to each vector component.

      (Number 10)
      (ValueOf (Concept "foo") (Predicate "some key"))))

A more detailed exploration can be found in the /examples/atomspace/flow-formulas.scm file.