| … | … | @@ -7,6 +7,7 @@ |
| 7 | 7 | ; 1) Some source of text strings; actually a source of PhraseNode's |
| 8 | 8 | ; This source blocks if there's nothing to be read; else it |
| 9 | 9 | ; returns the next PhraseNode. The SRFI's call this a generator. |
| 10 | ; See sensory.scm |
| 10 | 11 | ; 2) A PromiseLink that wraps (PureExecLink (LgParseBonds ...)) |
| 11 | 12 | ; so that, when its executed, it calls the source and parses. |
| 12 | 13 | ; Or perhaps just a (Filter (Rule ...)) combo, instead of a |
| … | … | @@ -98,21 +99,20 @@ |
| 98 | 99 | ; Parses arrive as LinkValues. We want to apply a function to each. |
| 99 | 100 | ; How? Need: |
| 100 | 101 | ; 4) IncrementLink just like cog-inc-value! |
| 101 | | ; or is it enough to do atomic lock? Make SetValue exec under lock. |
| 102 | ; or is it enough to do atomic lock? |
| 103 | ; Make SetValue exec under lock. ... easier said than done. |
| 104 | ; risks deadlock. |
| 102 | 105 | ; |
| 103 | 106 | ; cog-update-value calls |
| 104 | 107 | ; asp->increment_count(h, key, fvp->value())); |
| 105 | 108 | |
| 106 | | ; Works but non-atomic. |
| 107 | | ; Also requires RuleLink to work |
| 109 | ; Below works but is a non-atomic increment. |
| 108 | 110 | (define ed (Edge (Bond "ANY") (List (Word "words") (Word "know")))) |
| 109 | 111 | (define (doinc) |
| 110 | 112 | (cog-execute! |
| 111 | 113 | (SetValue ed (Predicate "count") |
| 112 | 114 | (Plus (Number 0 0 1) |
| 113 | | (Cond (FloatValueOf ed (Predicate "count")) |
| 114 | | (FloatValueOf ed (Predicate "count")) |
| 115 | | (FloatValueOf (Number 0 0 0))))))) |
| 115 | (FloatValueOf ed (Predicate "count") (Number 0 0 0)))))) |
| 116 | 116 | |
| 117 | 117 | |
| 118 | 118 | ; (load "count-agent.scm") |