summaryrefslogtreecommitdiff
path: root/starts/meaning-vm/helpers.hpp
diff options
context:
space:
mode:
authorolpc user <olpc@xo-5d-f7-86.localdomain>2019-11-22 13:35:48 -0800
committerolpc user <olpc@xo-5d-f7-86.localdomain>2019-11-22 13:35:48 -0800
commit8565b47b9e8a59ac06e4f739d63218b0f1e5cb05 (patch)
treea6b42986293d5e6f3fa7d624bf783bc65db38cf3 /starts/meaning-vm/helpers.hpp
parent018ced49ce429b123cbf63534d75f16ca91a96c2 (diff)
downloadstandingwithresilience-8565b47b9e8a59ac06e4f739d63218b0f1e5cb05.tar.gz
standingwithresilience-8565b47b9e8a59ac06e4f739d63218b0f1e5cb05.zip
basic habit state change meaning boilerplate
Diffstat (limited to 'starts/meaning-vm/helpers.hpp')
-rw-r--r--starts/meaning-vm/helpers.hpp35
1 files changed, 33 insertions, 2 deletions
diff --git a/starts/meaning-vm/helpers.hpp b/starts/meaning-vm/helpers.hpp
index f1b9e36..d151849 100644
--- a/starts/meaning-vm/helpers.hpp
+++ b/starts/meaning-vm/helpers.hpp
@@ -1,7 +1,32 @@
#pragma once
-#include "concept.hpp"
+// Provides for syntax sugar easing hardcoding.
+// 1. concept names
+// use declrefs(apple, is, fruit, water, has)
+// to quickly define the named ref variables,
+// referring always to the same named concept.
+// the ref constructor provides for using
+// 'true' and 'false' as refs.
+// 2. links
+// links may be quickly made with
+// apple[is = fruit, has = water]
+// which links 'apple' by 'is' to 'fruit'
+// and by 'has' to 'water' in one line
+// 3. hyphenation
+// refs may be hyphenated (subtracted) to
+// produce a new ref with the conglomerate name
+// apple-has-water.name(): "apple-has-water"
+// this may be expanded upon.
+// 4. anonymous concept creation
+// an unnamed instance of a concept may be created with the a() or an() equivalent functions:
+// ref anongreenapple = an(apple)[color = green];
+// it will be given a name such as apple-3
+// 5. quick group checking
+// the obverse of the a()/an() functions is provided
+// by ref::isa() and ref::isan() which quickly check
+// if there is an "is" link to the passed ref.
+#include "concept.hpp"
#include <sstream>
template <typename... T>
@@ -19,6 +44,12 @@ void __helper_init_ref_names(std::string names, T &... refrefs)
}
}
-#define decl(...) \
+#define declrefs(...) \
ref __VA_ARGS__; \
__helper_init_ref_names(#__VA_ARGS__, __VA_ARGS__)
+
+concept operator,(concept a, concept b);
+ref operator-(ref a, ref b);
+
+ref a(ref what);
+ref an(ref what);