From 88921e8a2174fa9d39fcbaf620bf70fdb3fa48d8 Mon Sep 17 00:00:00 2001 From: user Date: Thu, 19 Dec 2019 14:50:57 -0800 Subject: different list approach from othet device --- starts/meaning-vm/habit-starts/learning-parts.cpp | 31 +++++++++++++++++++++++ 1 file changed, 31 insertions(+) (limited to 'starts/meaning-vm/habit-starts') diff --git a/starts/meaning-vm/habit-starts/learning-parts.cpp b/starts/meaning-vm/habit-starts/learning-parts.cpp index ee55b04..365653b 100644 --- a/starts/meaning-vm/habit-starts/learning-parts.cpp +++ b/starts/meaning-vm/habit-starts/learning-parts.cpp @@ -1185,3 +1185,34 @@ static int __init = ([]()->int{ return 0; })(); +diff --git a/starts/meaning-vm/habit-starts/learning-parts.cpp b/starts/meaning-vm/habit-starts/learning-parts.cpp +index ee55b04..09c7b64 100644 +@@ -1127,10 +94,13 @@ static int __init = ([]()->int{ + + if (!happened.linked(whenever-list)) { return; } + +- (until-each-list-item-context-in-list)(action-whenever-happened, ctx, happened.get(whenever-list)); ++ ref stub = a(event); ++ stub.set(event, ev); ++ ++ (until-each-list-item-context-in-list)(action-whenever-happened, stub, happened.get(whenever-list)); + }); + +- ahabit(action-whenever-happened, ((list-item, li), (happened-context, hapctx)), ++ ahabit(action-whenever-happened, ((list-item, li), (event, h)), + { + // here: when we trigger a behavior, we want information associated with producing the trigger, + // as well as the event that triggered. that's two contexts. +@@ -1142,8 +112,11 @@ static int __init = ([]()->int{ + // take one context, which is the one prepared + // in the list, then we inject our context + // into that, inside a "happened" property. ++ ref actctx = i.get(action-context); ++ ++ actctx.set(happened, h); + +- i.get(action)(hapctx, i.get(action-context)); ++ i.get(action).fun()(i.get(actctx)); + }); + + ahabit(whenever-habit, ((happens, ev), (action, act), (action-context, actctx)), -- cgit v1.2.3