summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorolpc user <olpc@xo-5d-f7-86.localdomain>2019-12-13 10:52:53 -0800
committerolpc user <olpc@xo-5d-f7-86.localdomain>2019-12-13 10:52:53 -0800
commit3d4f57e3ba54ec4d63c1c94f35fd642b90cf1f29 (patch)
treeab04d595d9812bac399c00695a4b043d81a748a9
parente06acc0c9f4cad0ea5c24b1fbb107bea0b3466d2 (diff)
downloadstandingwithresilience-3d4f57e3ba54ec4d63c1c94f35fd642b90cf1f29.tar.gz
standingwithresilience-3d4f57e3ba54ec4d63c1c94f35fd642b90cf1f29.zip
stubbed out trigger habits
-rw-r--r--starts/meaning-vm/habit-starts/learning-parts.cpp24
-rw-r--r--starts/meaning-vm/habit-starts/learning-parts.hpp2
2 files changed, 24 insertions, 2 deletions
diff --git a/starts/meaning-vm/habit-starts/learning-parts.cpp b/starts/meaning-vm/habit-starts/learning-parts.cpp
index eebd054..92afc7d 100644
--- a/starts/meaning-vm/habit-starts/learning-parts.cpp
+++ b/starts/meaning-vm/habit-starts/learning-parts.cpp
@@ -8,11 +8,33 @@ static int __init = ([]()->int{
ahabit(happened-habit,
{
ref ev = ctx.get(happens);
- // TODO: perform each associated event
+ // TODO: perform each event associated with ctx[happens] (see line above)
+
+ // use a sub-habit for each call, so we can handle happened for them, too.
});
ahabit(whenever-habit,
{
+ // store ctx[action] on ctx[happens] as behavior to do
+ // store ctx[action-context] as context for behavior
+ // PROPOSE: automatically place [happened] inside [action-context] as a stub
+ // for call event objects, and then place [context] inside [happened].
+ // PROPOSE: report error if [action-context] contains [happened]
+ // as a stub for error patterns, it would be pretty nice to throw
+ // a unique concept ref for each error type. plan to add to level-0.
+ });
+
+ ahabit(stop-when-habit,
+ {
+ // remove doing ctx[action] for ctx[happens]
+ });
+
+ ahabit(once-habit,
+ {
+ // takes ctx[action] and ctx[happens] and ctx[action-context]
+ // uses above habits to do the action only once, probably by using
+ // a trigger on the habit-happening habit to check if a label is set,
+ // and remove the habit if it is.
});
return 0;
diff --git a/starts/meaning-vm/habit-starts/learning-parts.hpp b/starts/meaning-vm/habit-starts/learning-parts.hpp
index a446a1d..59fe5ab 100644
--- a/starts/meaning-vm/habit-starts/learning-parts.hpp
+++ b/starts/meaning-vm/habit-starts/learning-parts.hpp
@@ -13,7 +13,7 @@ decl(action, happens, context);
decl(happened); // happened-habit(ctx) performs actions associated with ctx[happens]
decl(whenever); // whenever-habit(ctx) stores to do ctx[action] when ctx[happens] happens
// providing ctx[action-context]
-decl(stop); decl(when); // stop-when-habit(ctx) removes doing ctx[happens] on ctx[event]
+decl(stop); decl(when); // stop-when-habit(ctx) removes doing ctx[action] on ctx[happens]
decl(once); // once-habit(ctx) stores to do ctx[action] the next time ctx[happens] happens
// providing ctx[action-context]