diff options
author | olpc user <olpc@xo-5d-f7-86.localdomain> | 2019-11-24 19:23:37 -0800 |
---|---|---|
committer | olpc user <olpc@xo-5d-f7-86.localdomain> | 2019-11-24 19:23:37 -0800 |
commit | cd03e291664cb102bde61d86a15f0add11809766 (patch) | |
tree | 9afb4bc872236b95debd5e20daf00797c563c666 /starts/meaning-vm/level-1/sugar.cpp | |
parent | dbbed1e4e1d4b3f268c71236c89f1d673fa0c165 (diff) | |
download | standingwithresilience-cd03e291664cb102bde61d86a15f0add11809766.tar.gz standingwithresilience-cd03e291664cb102bde61d86a15f0add11809766.zip |
messy but works. rushing to get this done with may have been a poor investment.
Diffstat (limited to 'starts/meaning-vm/level-1/sugar.cpp')
-rw-r--r-- | starts/meaning-vm/level-1/sugar.cpp | 41 |
1 files changed, 41 insertions, 0 deletions
diff --git a/starts/meaning-vm/level-1/sugar.cpp b/starts/meaning-vm/level-1/sugar.cpp new file mode 100644 index 0000000..eeb2eb0 --- /dev/null +++ b/starts/meaning-vm/level-1/sugar.cpp @@ -0,0 +1,41 @@ +#include "sugar.hpp" + +#include "concepts.hpp" + +using namespace intellect::level1; +using namespace concepts; + +namespace intellect { +namespace level1 { + +ref operator-(ref a, ref b) +{ + return ref(a.name() + "-" + b.name()); +} + +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.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); +} + +} +} |