| … | … | @@ -122,7 +122,7 @@ |
| 122 | 122 | 'count-type - Return the type of the Value holding the count. If the |
| 123 | 123 | base class LLOBJ provides this method, then this type will be used |
| 124 | 124 | when first creating a Value to hold the count. If the base class |
| 125 | | does not provide this, then the default of `CountTruthValue` will |
| 125 | does not provide this, then the default of `FloatValue` will |
| 126 | 126 | be used. The count-type should be a subtype of type `FloatValue`, |
| 127 | 127 | as this is the only type capable of holding numbers. |
| 128 | 128 | |
| … | … | @@ -131,19 +131,19 @@ |
| 131 | 131 | then this offset will be used when setting or incrementing the |
| 132 | 132 | scalar count. If the base class does not provide this, then the |
| 133 | 133 | default of 2 will be used. This default is the location of the |
| 134 | | count field on `CountTruthValue`'s and is thus backwards-compat |
| 134 | count field on `FloatValue`'s and is thus backwards-compat |
| 135 | 135 | with older code. |
| 136 | 136 | |
| 137 | 137 | If 'count-ref is provided and returns #f, then all counts will |
| 138 | 138 | be treated as vectors, so that gets, sets and increments all |
| 139 | 139 | operate on vectors. |
| 140 | 140 | " |
| 141 | | ; By default, the count is stored as a CountTruthValue. |
| 141 | ; By default, the count is stored as a FloatValue. |
| 142 | 142 | ; That means that it is on the TruthValue Key, and is the |
| 143 | 143 | ; third number (the first two being strength and confidence.) |
| 144 | 144 | ; These defaults are used if and only if the base object does |
| 145 | 145 | ; not provide these. |
| 146 | | (define (count-type) 'CountTruthValue) |
| 146 | (define (count-type) 'FloatValue) |
| 147 | 147 | (define (count-key) (PredicateNode "*-TruthValueKey-*")) |
| 148 | 148 | (define (count-ref) 2) |
| 149 | 149 | |
| … | … | @@ -179,7 +179,7 @@ |
| 179 | 179 | (cog-set-value-ref! PAIR cnt-key CNT cnt-ref)) |
| 180 | 180 | |
| 181 | 181 | ; Increment location. Unlike cog-set-value-ref!, this will |
| 182 | | ; automatically create the FloatValue (or CountTruthValue). |
| 182 | ; automatically create the FloatValue. |
| 183 | 183 | (define (inc-scalar-count PAIR CNT) |
| 184 | 184 | (cog-inc-value! PAIR cnt-key CNT cnt-ref)) |
| 185 | 185 | |
| … | … | @@ -351,8 +351,8 @@ |
| 351 | 351 | |
| 352 | 352 | ; Return the observed count for the pair PAIR. |
| 353 | 353 | ; If the pair has nothing at the storage key, fetch it. |
| 354 | | ; If the pair has the wrong type, e.g. SimpleTV instead of CountTV |
| 355 | | ; then fetch it. Be surgical w/ the fetch. Get only what we need. |
| 354 | ; If the pair has the wrong type, then fetch it. |
| 355 | ; Be surgical w/ the fetch. Get only what we need. |
| 356 | 356 | ; |
| 357 | 357 | ; This uses a mutex to minimize, but not avoid a race window |
| 358 | 358 | ; involving fetch-and-add. Users that try to fetch non-existant |