diff options
Diffstat (limited to 'starts/meaning-vm/habit-starts')
-rw-r--r-- | starts/meaning-vm/habit-starts/learning-parts.cpp | 37 |
1 files changed, 37 insertions, 0 deletions
diff --git a/starts/meaning-vm/habit-starts/learning-parts.cpp b/starts/meaning-vm/habit-starts/learning-parts.cpp index 7b3000e..56c7ffa 100644 --- a/starts/meaning-vm/habit-starts/learning-parts.cpp +++ b/starts/meaning-vm/habit-starts/learning-parts.cpp @@ -235,6 +235,43 @@ static int __init = ([]()->int{ })); }); + using links_it = level0::baseref::links_t::iterator; + ahabit(populate-link-entry, ((link-entry, le)), + { + result = le; + auto & it = result.vget<links_it>(); + if (it != result["source"].links().end()) { + result.set("type", it->first); + result.set("target", it->second); + } else { + result.unlink("type"); + result.unlink("target"); + } + }); + ahabit(first-link-entry, ((concept, c)), + { + result = level1::alloc(level, c.links().begin()); + result.set("source", c); + (populate-link-entry)(result); + }); + ahabit(last-link-entry, ((concept, c)), + { + result = level1::alloc(level, --c.links().end()); + result.set("source", c); + (populate-link-entry)(result); + }); + ahabit(next-link-entry, ((link-entry, le)), + { + result = le; + ++result.vget<links_it>(); + (populate-link-entry)(result); + }); + ahabit(previous-link-entry, ((link-entry, le)), + { + result = le; + --result.vget<links_it>(); + (populate-link-entry)(result); + }); /* ahabit(happened-habit, ((happened, ev)), |