summaryrefslogtreecommitdiff
path: root/starts
diff options
context:
space:
mode:
authorolpc user <olpc@xo-5d-f7-86.localdomain>2019-12-09 02:49:25 -0800
committerolpc user <olpc@xo-5d-f7-86.localdomain>2019-12-09 02:49:25 -0800
commit8d238e65a88502b897f1944b7844afffdbc0d761 (patch)
treedf460a7554ebcc0c162a3c5c67b17bfc38f0b4c0 /starts
parentf5ec96b6f4f88065b4cc6c24057af15d1f025ad4 (diff)
downloadstandingwithresilience-8d238e65a88502b897f1944b7844afffdbc0d761.tar.gz
standingwithresilience-8d238e65a88502b897f1944b7844afffdbc0d761.zip
level 1 subref operator
Diffstat (limited to 'starts')
-rw-r--r--starts/meaning-vm/level-1/baseref.hpp1
-rw-r--r--starts/meaning-vm/level1.cpp10
2 files changed, 6 insertions, 5 deletions
diff --git a/starts/meaning-vm/level-1/baseref.hpp b/starts/meaning-vm/level-1/baseref.hpp
index 187b5df..e97db2d 100644
--- a/starts/meaning-vm/level-1/baseref.hpp
+++ b/starts/meaning-vm/level-1/baseref.hpp
@@ -28,6 +28,7 @@ struct baseref : public level0::baseref<ref>
explicit operator char const *() const { return getname(self)->data.c_str(); }
ref operator-(ref other) const { return hyphenate(self, other); }
+ ref operator[](ref subref) const { return self.get(subref); }
template <typename T>
void vset(ref const & type, T const & v) { self.set(type, level1::alloc(v)); }
diff --git a/starts/meaning-vm/level1.cpp b/starts/meaning-vm/level1.cpp
index 2e005e2..9498ddf 100644
--- a/starts/meaning-vm/level1.cpp
+++ b/starts/meaning-vm/level1.cpp
@@ -38,11 +38,11 @@ int main()
);
(make-linked).fset(
act,
- (std::function<void(ref)>)[](ref args)
+ (std::function<void(ref)>)[&](ref args)
{
- ref source = args.get("A");
- ref type = args.get("B");
- ref target = args.get("C");
+ ref source = args[A];
+ ref type = args[B];
+ ref target = args[C];
std::cout << "Linking " << source.name() << " by " << type.name() << " to " << target.name() << std::endl;
source.link(type, target);
}
@@ -51,7 +51,7 @@ int main()
std::cout << (make-linked).dump("dumped", true) << std::endl;
decls(apple, fruit);
- (make-linked).get(act)
+ (make-linked)[act]
(a(function-argument)
.link(
A, apple,