summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--starts/meaning-vm/habit-starts/learning-parts.cpp19
-rw-r--r--starts/meaning-vm/level-0/baseref.hpp12
2 files changed, 25 insertions, 6 deletions
diff --git a/starts/meaning-vm/habit-starts/learning-parts.cpp b/starts/meaning-vm/habit-starts/learning-parts.cpp
index c53b260..b5cd56c 100644
--- a/starts/meaning-vm/habit-starts/learning-parts.cpp
+++ b/starts/meaning-vm/habit-starts/learning-parts.cpp
@@ -234,6 +234,25 @@ static int __init = ([]()->int{
i, l);
});
+ using links_it = level0::baseref::links_t::iterator;
+ ahabit(populate-link-entry, ((link-entry, le)),
+ {
+ result = le;
+ result.set("source", c);
+ result.set("type", result.vget<links_t>().first);
+ result.set("target", result.vget<links_t>().second);
+ });
+ ahabit(first-link-entry, ((concept, c)),
+ {
+ result = level1::alloc(level, c.links().begin());
+ (populate-link-entry)(result);
+ });
+ ahabit(last-link-entry, ((concept, c)),
+ {
+ result = level1::alloc(level, --c.links().end());
+ (populate-link-entry)(result);
+ });
+
ahabit(happened-habit, ((happened, ev)),
{
if (!happened.linked(whenever-list)) { return; }
diff --git a/starts/meaning-vm/level-0/baseref.hpp b/starts/meaning-vm/level-0/baseref.hpp
index 69880c8..d20b22a 100644
--- a/starts/meaning-vm/level-0/baseref.hpp
+++ b/starts/meaning-vm/level-0/baseref.hpp
@@ -108,18 +108,18 @@ private:
struct array
{
- mutated_it<ref,typename concept::array::iterator> begin() { return array.begin(); }
- mutated_it<ref,typename concept::array::iterator> end() { return array.end(); }
+ using iterator = mutated_it<ref,typename concept::array::iterator>;
+ iterator begin() { return array.begin(); }
+ iterator end() { return array.end(); }
typename concept::array array;
};
struct links_t
{
- mutated_it<std::pair<ref,ref>,typename decltype(concept::links)::iterator> begin()
- { return links.begin(); }
- mutated_it<std::pair<ref,ref>,typename decltype(concept::links)::iterator> end()
- { return links.end(); }
+ using iterator = mutated_it<std::pair<ref,ref>,typename decltype(concept::links)::iterator>;
+ iterator begin() { return links.begin(); }
+ iterator end() { return links.end(); }
decltype(concept::links) & links;
};