From 2bf700189c287c678539ba9bbf05167476dde312 Mon Sep 17 00:00:00 2001 From: olpc user Date: Wed, 25 Dec 2019 09:57:26 -0800 Subject: - --- starts/meaning-vm/level-2/habits.cpp | 23 +++++++++++++++++++++-- 1 file changed, 21 insertions(+), 2 deletions(-) (limited to 'starts') diff --git a/starts/meaning-vm/level-2/habits.cpp b/starts/meaning-vm/level-2/habits.cpp index 5cb071e..16133ca 100644 --- a/starts/meaning-vm/level-2/habits.cpp +++ b/starts/meaning-vm/level-2/habits.cpp @@ -306,11 +306,30 @@ int createhabits() (action-list-item)(list-entry-item(le), subctx); })); }); + + // maybe condition and list could be merged better by factoring out the concept + // of translating? + // we're going to want to provide lists of subactions to condition + // the irritation around not having the condition be a function is the + // creation of anonymous variable names to hold the values. is likely fine. + // note: the name "outer-context" is being treated specially. we'll just use that. + // this name could make a quoting requirement. could be worked around. + // + // if we remove outer-context, we'll probably need to recognize condition- + // action in action-list-item, and pass the outer-context to it. + // either way, we can implement condition-action with outer-context as + // a passed value. // TODO: a habit that evaluates habits depending on a condition - ahabit(condition-action, ((context, ctx), (condition, cond), (actions, a)), + ahabit(make-condition, (( + ahabit(condition-action, ((condition, cond), (actions, a)), { - condition.fun(ctx); + // I'll leave outer-context special, and imply quoting. + // no mapping. + // so, we might want action-list-entries to be actionable + // but easiest to just handle action lists here + + //condition.fun(ctx); // how to pass context to condition within action-list? // // this function will have one context. -- cgit v1.2.3