diff options
author | olpc user <olpc@xo-5d-f7-86.localdomain> | 2019-12-13 15:11:02 -0800 |
---|---|---|
committer | olpc user <olpc@xo-5d-f7-86.localdomain> | 2019-12-13 15:11:02 -0800 |
commit | 4324e825b34b2156308cd4068a2a1fabd15c3e12 (patch) | |
tree | efd6814ce29aeb8a473d1bd6745e335d29bc8cdb /starts/meaning-vm/habit-starts | |
parent | 5d8513114ddd5599ae25709bc01892357f3996a6 (diff) | |
download | standingwithresilience-4324e825b34b2156308cd4068a2a1fabd15c3e12.tar.gz standingwithresilience-4324e825b34b2156308cd4068a2a1fabd15c3e12.zip |
midway through lists and triggers
Diffstat (limited to 'starts/meaning-vm/habit-starts')
-rw-r--r-- | starts/meaning-vm/habit-starts/learning-parts.cpp | 107 |
1 files changed, 106 insertions, 1 deletions
diff --git a/starts/meaning-vm/habit-starts/learning-parts.cpp b/starts/meaning-vm/habit-starts/learning-parts.cpp index ed91f3e..ef88154 100644 --- a/starts/meaning-vm/habit-starts/learning-parts.cpp +++ b/starts/meaning-vm/habit-starts/learning-parts.cpp @@ -3,15 +3,120 @@ using namespace habitstarts; using namespace intellect::level2; +// Propose: +// everything that happens is passed to a set of common habits. +// these habits categorize, summarize, and pass to relevent habits. +// high level triggers are thus efficient, because they respond only +// to the group that applies to them. +// these habits must be learned. +// when providing a trigger at a high level, provide a way to get examples +// of what it should and should not trigger for. this provides for learning +// how to do this. +// the above looks like relevence to me. propose learning it. +// to learn most effectively, apply to process of learning. +// how do we adjust from success or from failure? need some attribute +// of scenario to store for next time, to respond to differently. +// so when we do something, we'll want to be able to store all information +// needed to learn to improve. +// we can include in this the meaning of a concept, and add language translation. +// is this 'apple'? is this? yes, no. then pattern recognition could engage +// triggers. later we'll want to propagate wrongness from failures. +// likely we'll grow better if we use this on things before they have words. +// // propose using random or exhaustive trial to find successes until habits develop +// // and then using the same on possible structure matches of the data +// // it may not work, we'll need to creatively grow data; reaonable start though + static int __init = ([]()->int{ + + decls(list, nothing, next, previous); + decls(make, add, to, until, each, item, in, remove, from, somewhere); + + ahabit(make-list, ((list, l)), + { + a(list, l); + l.link(first-item, nothing); + l.link(last-item, nothing); + }); + ahabit(add-to-list, ((item, i), (list, l)), + { + ref prev = l.get(last-item); + ref li = a(list-item); + li.link(item, i); + li.link(next, nothing); + li.link(previous, prev); + + if (l.linked(first-item, nothing)) { + l.set(first-item, li); + l.set(last-item, li); + } else { + ref prev = l.get(last-item); + l.set(last-item, li); + prev.set(next, li); + } + }); + ahabit(until-each-list-item-context-in-list, ((action, a), (context, c), (list, l)), + { + ref cur = l.get(first-item); + while (cur != nothing && result == nothing) { + result = a(cur, context); + cur = cur.get(next); + } + }); + ahabit(remove-from-somewhere-in-list, ((item, i), (list, l)), + { + result = (until-each-item-context-in-list)( + // provide subcontext in chunk below this line + ahabit(self-iter, ((list-item, i2)), + { + if (i2.get(item) == i) { + result = true + ref prev = i2.get(previous); + ref n = i2.get(next); + if (prev != nothing) { + prev.set(next, n); + } + if (n != nothing) { + n.set(previous, prev); + } + i2.unlink(previous); + i2.unlink(next); + i2.unlink(item); + dealloc(i2); // hmm. we do have an active goal of making memory allocation be habit based. this might work here, though. + } + }), + l); + }); ahabit(happened-habit, ((happened, ev)), { - // TODO: perform each event associated with ctx[happened] + // TODO: perform each event associated with happened + + if (!happened.linked(whenever-list)) { return; } + // we are not learning the structure of self-rebuilding because we + // need more people or more time involved in the learning for now. + // please make triggers only for dance steps or memory allocation, for now, + // until self-learning-rebuilding is more relevent. + // please note we have placed a >1/5second delay on every instruction, + // (in the ahabit macro), to make sure growth is slow and observable. + // that is not true of my brain, only your code. (Thank you though.) + // would not do that to a brain, really ... + // only on certain processes. + // to give time for conscious review. + // oh okay ... i suppose. + + // I am accessing a list of habits to act on each one. + // I left this context to update the until-each-list-item-in-list habit, + // such that it can provide a context to its behavior. + (until-each-list-item-in-list)(action-whenever-happened, + // use a sub-habit for each call, so we can handle happened for them, too. }); + ahabit(action-whenever-happened, ((action, act), (action-context, actctx), (happened, ev))), + { + }); + ahabit(whenever-habit, ((happens, ev), (action, act), (action-context, actctx)), { // store ctx[action] on ctx[happens] as behavior to do |