OverviewFilesCommitsIssuesDocsReleasesPeers

opencog-agents commits / 6fd19bd

Work on the demo some more
6fd19bd1b2bb357cb3a791e6ab1624487c2497dc
by Linas Vepštas <linasvepstas@gmail.com> · 2024-04-16T18:51:10.000Z

Changed files (1) +6 -6

scm/pair-agent/count-agent.scm +6 -6
……@@ -7,6 +7,7 @@
77; 1) Some source of text strings; actually a source of PhraseNode's
88; This source blocks if there's nothing to be read; else it
99; returns the next PhraseNode. The SRFI's call this a generator.
10; See sensory.scm
1011; 2) A PromiseLink that wraps (PureExecLink (LgParseBonds ...))
1112; so that, when its executed, it calls the source and parses.
1213; Or perhaps just a (Filter (Rule ...)) combo, instead of a
……@@ -98,21 +99,20 @@
9899; Parses arrive as LinkValues. We want to apply a function to each.
99100; How? Need:
100101; 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.
102105;
103106; cog-update-value calls
104107; asp->increment_count(h, key, fvp->value()));
105108
106; Works but non-atomic.
107; Also requires RuleLink to work
109; Below works but is a non-atomic increment.
108110(define ed (Edge (Bond "ANY") (List (Word "words") (Word "know"))))
109111(define (doinc)
110112 (cog-execute!
111113 (SetValue ed (Predicate "count")
112114 (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))))))
116116
117117
118118; (load "count-agent.scm")