summaryrefslogtreecommitdiff
path: root/starts/meaning-vm/main.cpp
diff options
context:
space:
mode:
authorolpc user <olpc@xo-5d-f7-86.localdomain>2019-11-23 09:11:28 -0800
committerolpc user <olpc@xo-5d-f7-86.localdomain>2019-11-23 09:11:28 -0800
commitfed2ac694bd028d119581ea05a3376e791aee97d (patch)
tree726785b677c3109a16a9b0b1b27ade16b2cfea51 /starts/meaning-vm/main.cpp
parentc0fdff872ca2c48939bacfefce020878ef92b44c (diff)
downloadstandingwithresilience-fed2ac694bd028d119581ea05a3376e791aee97d.tar.gz
standingwithresilience-fed2ac694bd028d119581ea05a3376e791aee97d.zip
more syntax sugar, building meaning
Diffstat (limited to 'starts/meaning-vm/main.cpp')
-rw-r--r--starts/meaning-vm/main.cpp30
1 files changed, 13 insertions, 17 deletions
diff --git a/starts/meaning-vm/main.cpp b/starts/meaning-vm/main.cpp
index c4207cb..6919791 100644
--- a/starts/meaning-vm/main.cpp
+++ b/starts/meaning-vm/main.cpp
@@ -1,5 +1,6 @@
#include "concept.hpp"
#include "helpers.hpp"
+#include "meaning.hpp"
using namespace std;
@@ -7,7 +8,7 @@ using namespace std;
void dumpconcept(ref r)
{
- declrefs(dumped, name);
+ decllnks(dumped, name);
for (auto & l : r->links) {
if (ref(l.first) == name) {
@@ -27,27 +28,22 @@ void dumpconcept(ref r)
int main()
{
- declrefs(is, link, type);
- is->link(is, link-type);
-
- declrefs(source, target);
- declrefs(linked, A, B, C, abc, variable);
- declrefs(trueness, truth, what, not);
-
- declrefs(add, unique, habit, needs, assumes, makes);
- A = a(variable);
- B = a(variable);
- C = a(variable);
+ declrefs(make, linked, habit);
+ declrefs(A, B, C);
+ decllnks(needs, assumes, makes);
// add a new unique link to a concept
// given A, B, C
// and assuming A is not linked by B to C,
// makes A be linked by B to C.
- add-link-unique = a(habit)[
- needs = a(variable, A), needs = a(variable, B), needs = a(variable, C),
- makes = a(link, abc-linked)[link-source = A, link-type = B, link-target = C],
- assumes = a(trueness, abc-not-linked)[what = abc-linked, truth = false]
+ // NEXT? make code for make-linked that takes a ref
+ // change the needs structure to use a model for the ref,
+ // with needed values specified as 'provided'
+ make-linked = a(habit)[
+ needs = and(avariable(A), avariable(B), avariable(C)),
+ assumes = not(A-B-C-linked = link(A, B, C)),
+ makes = A-B-C-linked
];
- dumpconcept(add-link-unique);
+ dumpconcept(make-linked);
}