summaryrefslogtreecommitdiff
path: root/starts/meaning-vm/habit-starts
diff options
context:
space:
mode:
Diffstat (limited to 'starts/meaning-vm/habit-starts')
-rw-r--r--starts/meaning-vm/habit-starts/common.hpp2
-rw-r--r--starts/meaning-vm/habit-starts/learning-parts.cpp13
-rw-r--r--starts/meaning-vm/habit-starts/learning-parts.hpp2
3 files changed, 9 insertions, 8 deletions
diff --git a/starts/meaning-vm/habit-starts/common.hpp b/starts/meaning-vm/habit-starts/common.hpp
index 963bbea..950930a 100644
--- a/starts/meaning-vm/habit-starts/common.hpp
+++ b/starts/meaning-vm/habit-starts/common.hpp
@@ -5,6 +5,8 @@
namespace habitstarts {
+using namespace intellect::level2;
+
decl(habit);
}
diff --git a/starts/meaning-vm/habit-starts/learning-parts.cpp b/starts/meaning-vm/habit-starts/learning-parts.cpp
index 92afc7d..ed91f3e 100644
--- a/starts/meaning-vm/habit-starts/learning-parts.cpp
+++ b/starts/meaning-vm/habit-starts/learning-parts.cpp
@@ -1,19 +1,18 @@
#include "learning-parts.hpp"
using namespace habitstarts;
-using namespace intellect::level1;
+using namespace intellect::level2;
static int __init = ([]()->int{
- ahabit(happened-habit,
+ ahabit(happened-habit, ((happened, ev)),
{
- ref ev = ctx.get(happens);
- // TODO: perform each event associated with ctx[happens] (see line above)
+ // TODO: perform each event associated with ctx[happened]
// use a sub-habit for each call, so we can handle happened for them, too.
});
- ahabit(whenever-habit,
+ ahabit(whenever-habit, ((happens, ev), (action, act), (action-context, actctx)),
{
// store ctx[action] on ctx[happens] as behavior to do
// store ctx[action-context] as context for behavior
@@ -24,12 +23,12 @@ static int __init = ([]()->int{
// a unique concept ref for each error type. plan to add to level-0.
});
- ahabit(stop-when-habit,
+ ahabit(stop-when-habit, ((action, act), (happens, ev)),
{
// remove doing ctx[action] for ctx[happens]
});
- ahabit(once-habit,
+ ahabit(once-habit, ((happens, ev), (action, act), (action-context, actctx)),
{
// takes ctx[action] and ctx[happens] and ctx[action-context]
// uses above habits to do the action only once, probably by using
diff --git a/starts/meaning-vm/habit-starts/learning-parts.hpp b/starts/meaning-vm/habit-starts/learning-parts.hpp
index 59fe5ab..e3a3ccc 100644
--- a/starts/meaning-vm/habit-starts/learning-parts.hpp
+++ b/starts/meaning-vm/habit-starts/learning-parts.hpp
@@ -9,7 +9,7 @@ namespace habitstarts {
// stop doing B whenever A happens.
// when A happens, do B once.
-decl(action, happens, context);
+decl(action); decl(happens); decl(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]