From cd03e291664cb102bde61d86a15f0add11809766 Mon Sep 17 00:00:00 2001 From: olpc user Date: Sun, 24 Nov 2019 19:23:37 -0800 Subject: messy but works. rushing to get this done with may have been a poor investment. --- starts/meaning-vm/level-1/sugar.cpp | 41 +++++++++++++++++++++++++++++++++++++ 1 file changed, 41 insertions(+) create mode 100644 starts/meaning-vm/level-1/sugar.cpp (limited to 'starts/meaning-vm/level-1/sugar.cpp') 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); +} + +} +} -- cgit v1.2.3