summaryrefslogtreecommitdiff
path: root/starts
diff options
context:
space:
mode:
authoruser <user@localhost.localdomain>2019-12-23 11:51:02 -0800
committeruser <user@localhost.localdomain>2019-12-23 11:51:02 -0800
commitc8e3e06b79c54f67961fdeba1504ec1cca206719 (patch)
tree71da03cb8eb044fcf820fd55ae7ee6945be67445 /starts
parente813d05b971e68429de7ab0704daa8f5bfc403aa (diff)
downloadstandingwithresilience-c8e3e06b79c54f67961fdeba1504ec1cca206719.tar.gz
standingwithresilience-c8e3e06b79c54f67961fdeba1504ec1cca206719.zip
simple link entry habits
Diffstat (limited to 'starts')
-rw-r--r--starts/meaning-vm/habit-starts/learning-parts.cpp25
1 files changed, 22 insertions, 3 deletions
diff --git a/starts/meaning-vm/habit-starts/learning-parts.cpp b/starts/meaning-vm/habit-starts/learning-parts.cpp
index b5cd56c..1b5054b 100644
--- a/starts/meaning-vm/habit-starts/learning-parts.cpp
+++ b/starts/meaning-vm/habit-starts/learning-parts.cpp
@@ -238,18 +238,37 @@ static int __init = ([]()->int{
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);
+ 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);
});