summaryrefslogtreecommitdiff
path: root/intellect-framework-from-internet/starts/meaning-vm/level-1/sugar.cpp
diff options
context:
space:
mode:
authorolpc user <olpc@xo-5d-f7-86.localdomain>2020-01-10 18:05:43 -0800
committerolpc user <olpc@xo-5d-f7-86.localdomain>2020-01-10 18:05:43 -0800
commit3223a360d0e70f75497aecf8c033a4f987335b5b (patch)
treec34e5ed5d7aa83513447644b4774c0449336657f /intellect-framework-from-internet/starts/meaning-vm/level-1/sugar.cpp
parent26c980d302adce8e3d802cb8db8ab1c69d58ce1a (diff)
downloadstandingwithresilience-3223a360d0e70f75497aecf8c033a4f987335b5b.tar.gz
standingwithresilience-3223a360d0e70f75497aecf8c033a4f987335b5b.zip
I'm confused and am handling multiple unexpected systems issues
Diffstat (limited to 'intellect-framework-from-internet/starts/meaning-vm/level-1/sugar.cpp')
-rw-r--r--intellect-framework-from-internet/starts/meaning-vm/level-1/sugar.cpp84
1 files changed, 0 insertions, 84 deletions
diff --git a/intellect-framework-from-internet/starts/meaning-vm/level-1/sugar.cpp b/intellect-framework-from-internet/starts/meaning-vm/level-1/sugar.cpp
deleted file mode 100644
index 567edac..0000000
--- a/intellect-framework-from-internet/starts/meaning-vm/level-1/sugar.cpp
+++ /dev/null
@@ -1,84 +0,0 @@
-#include "sugar.hpp"
-
-#include "concepts.hpp"
-
-#include <stdexcept>
-
-using namespace intellect::level1;
-using namespace concepts;
-
-namespace intellect {
-namespace level1 {
-
- // no way to specify allocator
-ref a(ref group)
-{
- static unsigned long long gid = 0;
- ref ret(group.name() + "-" + std::to_string(gid++));
- ret.link(is, group);
- ret.link(is, anonymous);
- return ret;
-}
-ref a(ref group, ref name)
-{
- if (name == nothing) { return a(group); }
- if (!name.isa(group)) {
- name.link(is, group);
- }
- return name;
-}
-ref an(ref group)
-{
- return a(group);
-}
-ref an(ref group, ref name)
-{
- return a(group, name);
-}
-
-bool isanonymous(ref topic)
-{
- return topic.isa(concepts::anonymous);
-}
-
-ref movetoname(ref anonymous, ref name)
-{
- if (!isanonymous(anonymous)) { throw std::invalid_argument("not anonymous"); }
- if (isanonymous(name)) { throw std::invalid_argument("not named"); }
-
- // this only provides for writing to empty concepts, because merging concepts is
- // best done with a knowledge of which links can be multiply attached, and that
- // information is not available at this level.
- bool nonempty = false;
- for (auto & l : name.links()) {
- if (l.first.linked(level0::concepts::allocator(), level0::concepts::level0allocations())) { continue; }
- if (l.second.isa(concepts::text)) { continue; }
- nonempty = true;
- }
- if (nonempty) {
- for (auto & link : anonymous.links()) {
- if (link.first == concepts::is && link.second == concepts::anonymous) { continue; }
- if (link.first.linked(level0::concepts::allocator(), level0::concepts::level0allocations())) { continue; }
- if (link.second.isa(concepts::text)) { continue; }
- if (!name.linked(link.first, link.second)) {
- throw std::logic_error(name.name() + " already defined otherwise from " + anonymous.getAll(concepts::is).begin()->name());// + ": \n" + dump(name, ref("dump"), ref(true)) + dump(anonymous, ref("dump"), ref(true)));
- }
- }
- }
- anonymous.unlink(concepts::is, concepts::anonymous);
- auto nam = anonymous.get(concepts::name);
- anonymous.unlink(concepts::name, nam);
- if (!nonempty) {
- for (auto & l : anonymous.links()) {
- if (l.first.linked(level0::concepts::allocator(), level0::concepts::level0allocations())) { continue; }
- name.link(l.first, l.second);
- }
- }
- anonymous.link(concepts::name, nam);
- dealloc(anonymous, level0::concepts::allocations());
- //dealloc(nam, level0::concepts::allocations());
- return name;
-}
-
-}
-}