summaryrefslogtreecommitdiff
path: root/starts
diff options
context:
space:
mode:
Diffstat (limited to 'starts')
-rw-r--r--starts/meaning-vm/.gitignore1
-rw-r--r--starts/meaning-vm/level-1/baseref.hpp2
-rw-r--r--starts/meaning-vm/level-1/funcs.cpp17
-rw-r--r--starts/meaning-vm/level-1/funcs.hpp2
-rw-r--r--starts/meaning-vm/level-2/funcs.cpp32
-rw-r--r--starts/meaning-vm/level-2/habits.cpp216
-rw-r--r--starts/meaning-vm/level-2/habits.hpp3
-rw-r--r--starts/meaning-vm/level1.cpp4
-rw-r--r--starts/meaning-vm/level2.cpp57
-rw-r--r--starts/meaning-vm/makefile10
10 files changed, 209 insertions, 135 deletions
diff --git a/starts/meaning-vm/.gitignore b/starts/meaning-vm/.gitignore
index 206b76d..499b868 100644
--- a/starts/meaning-vm/.gitignore
+++ b/starts/meaning-vm/.gitignore
@@ -1,6 +1,7 @@
.*
*.ii
*.o
+*.d
*.a
*.tmp
level?
diff --git a/starts/meaning-vm/level-1/baseref.hpp b/starts/meaning-vm/level-1/baseref.hpp
index 93e18ae..ac6ff9c 100644
--- a/starts/meaning-vm/level-1/baseref.hpp
+++ b/starts/meaning-vm/level-1/baseref.hpp
@@ -48,7 +48,7 @@ struct baseref : public level0::baseref<ref>
template <typename... Ref>
ref operator()(Ref... args) { return self.template fun<Ref...>()(args...); }
- std::string dump(ref skipmarkertype, ref skipmarkertarget) { return level1::dump(self, skipmarkertype, skipmarkertarget); };
+ std::string dump(ref set) { return level1::dump(self, set); };
private:
template <typename... Refs>
diff --git a/starts/meaning-vm/level-1/funcs.cpp b/starts/meaning-vm/level-1/funcs.cpp
index 2ba2d0f..af4815b 100644
--- a/starts/meaning-vm/level-1/funcs.cpp
+++ b/starts/meaning-vm/level-1/funcs.cpp
@@ -150,10 +150,10 @@ concept* hyphenate(concept* a, concept* b)
return getnamed(getname(a) + "-" + getname(b));
}
-std::string dump(concept* what, concept* skipmarkertype, concept* skipmarkertarget)
+std::string dump(concept* what, concept* set)
{
std::stringstream ss;
- if (what->linked(skipmarkertype, skipmarkertarget)) {
+ if (set->linked(what, _true)) {
return {};
}
for (auto & link : ref(what).links()) {
@@ -162,17 +162,14 @@ std::string dump(concept* what, concept* skipmarkertype, concept* skipmarkertarg
if (ss.str().size() == 0) {
ss << ref(what).name() << " " << (void*) what << ":\n";
}
- ss << " " << link.first.name() << ": " << link.second.name() << "\n";
+ ss << " " << link.first.name() << ": " << link.second.name() << " " << (void*)link.second << "\n";
}
- what->link(skipmarkertype, skipmarkertarget);
+ set->link(what, _true);
for (auto & link : ref(what).links()) {
- if (link.first.linked(allocator, level0-allocations)) { continue; }
- if (link.second.linked(allocator, level1-allocations)) { continue; }
- if (link.first.ptr() == skipmarkertype && link.second.ptr() == skipmarkertarget) {
- continue;
- }
+ if (link.first.linked(level0::concepts::allocator(), level0::concepts::level0allocations())) { continue; }
+ if (link.second.linked(level0::concepts::allocator(), level1-allocations)) { continue; }
if (link.second.isa(concepts::name)) { continue; }
- ss << dump(link.second, skipmarkertype, skipmarkertarget);
+ ss << dump(link.second, set);
}
return ss.str();
}
diff --git a/starts/meaning-vm/level-1/funcs.hpp b/starts/meaning-vm/level-1/funcs.hpp
index d70a868..185de7b 100644
--- a/starts/meaning-vm/level-1/funcs.hpp
+++ b/starts/meaning-vm/level-1/funcs.hpp
@@ -21,7 +21,7 @@ concept* hyphenate(concept* a, concept* b);
concept* alloc(concept* allocator, std::any val);
-std::string dump(concept * what, concept * skipmarkertype, concept * skipmarkertarget);
+std::string dump(concept * what, concept * set);
}
}
diff --git a/starts/meaning-vm/level-2/funcs.cpp b/starts/meaning-vm/level-2/funcs.cpp
index 0cef918..89d9c30 100644
--- a/starts/meaning-vm/level-2/funcs.cpp
+++ b/starts/meaning-vm/level-2/funcs.cpp
@@ -3,6 +3,7 @@
#include "../level-1/sugar.hpp"
#include "ref.hpp"
#include "concepts.hpp"
+#include "habits.hpp"
namespace intellect {
using namespace level1;
@@ -54,8 +55,13 @@ ref dohabit(ref habit, std::initializer_list<ref> args)
{
using namespace concepts;
ref posinf = habit.get(information-needed);
+ ref subctx = makeconcept();
+ subctx.link("outer-context", ref::context());
+ ref::context() = subctx;
for (ref const & arg : args) {
if (!posinf.linked(next-information)) {
+ ref::context() = subctx.get("outer-context");
+ conceptunmake(subctx);
throw an(unexpected-information).link
(concepts::habit, habit,
information-value, arg);
@@ -67,6 +73,8 @@ ref dohabit(ref habit, std::initializer_list<ref> args)
while (posinf.linked(next-information)) {
posinf = posinf[next-information];
if (!posinf.linked(assume)) {
+ ref::context() = subctx.get("outer-context");
+ conceptunmake(subctx);
throw a(information-needed).link
(concepts::habit, habit,
information, posinf);
@@ -80,24 +88,30 @@ ref dohabit(ref habit, std::initializer_list<ref> args)
posinf = posinf[next-information];
ref::context().unlink(posinf[information]);
}
+ ref ret = nothing;
if (ref::context().linked(result)) {
- ref ret = ref::context().get(result);
+ ret = ref::context().get(result);
ref::context().unlink(result, ret);
- return ret;
}
- return nothing;
+ ref::context() = subctx.get("outer-context");
+ conceptunmake(subctx);
+ return ret;
}
ref dohabit(ref habit, std::initializer_list<std::initializer_list<ref>> pairs)
{
using namespace concepts;
// TODO: subcontexts or call instances
- ref ctx = ref::context();
+ ref ctx = makeconcept();
+ ctx.link("outer-context", ref::context());
+ ref::context() = ctx;
ref infn = habit.get(information-needed);
std::map<ref, ref> provided;
for (auto pair : pairs) {
auto second = pair.begin(); ++ second;
if (!infn.linked(*pair.begin())) {
+ ref::context() = ctx.get("outer-context");
+ conceptunmake(ctx);
throw an(unexpected-information).link
(concepts::habit, habit,
information, *pair.begin(),
@@ -114,6 +128,8 @@ ref dohabit(ref habit, std::initializer_list<std::initializer_list<ref>> pairs)
if (nextinf.get(assume)) {
ctx.link(inf, nextinf.get(assume));
} else {
+ ref::context() = ctx.get("outer-context");
+ conceptunmake(ctx);
throw a(information-needed).link
(concepts::habit, habit,
information, inf);
@@ -137,12 +153,14 @@ ref dohabit(ref habit, std::initializer_list<std::initializer_list<ref>> pairs)
// auto second = pair.begin(); ++ second;
// ctx.unlink(pair.begin(), second);
//}
+ ref ret = nothing;
if (ctx.linked(result)) {
- ref ret = ctx.get(result);
+ ret = ctx.get(result);
ctx.unlink(result, ret);
- return ret;
}
- return nothing;
+ ref::context() = ctx.get("outer-context");
+ conceptunmake(ctx);
+ return ret;
}
}
diff --git a/starts/meaning-vm/level-2/habits.cpp b/starts/meaning-vm/level-2/habits.cpp
index 1891ec5..520ec5c 100644
--- a/starts/meaning-vm/level-2/habits.cpp
+++ b/starts/meaning-vm/level-2/habits.cpp
@@ -3,6 +3,8 @@
#include "sugar.hpp"
#include "concepts.hpp"
+#include <iostream>
+
namespace intellect {
namespace level2 {
@@ -33,19 +35,119 @@ void poplinkentry(ref le)
}
}
+ref maketranslationmap(ref m, ref k = nothing)
+{
+ ref result = makeconcept();
+ result.link(
+ //habit, translation-map,
+ "translation", m
+ );
+ if (k != nothing) { result.link("known", k); }
+ return result;
+}
+
void contextmapinto(ref c1, ref m, ref c2)
{
decl(translation); decl(known); decl(nothing);
for (auto link : m.get(translation).links()) {
- c2.set(link.second, c1.get(link.first));
+ c2.set(link.first, c1.get(link.second));
}
if (m.linked(known) && m.get(known) != nothing) {
for (auto link : m.get(known).links()) {
- c2.set(link.second, link.first);
+ c2.set(link.first, link.second);
}
}
}
+void _steps(ref s, ref ctx)
+{
+ decls(context, active, outer, state, next, step, needed, known, map, information, action, made);
+ // PLEASE RUN SYSTEM WITH PROPER DELAY WHILE IT LEARNS (see top of file)
+ // until similarity is understood, new information shuold be slowest thing
+ // to produce.
+ // then, similar information until expansion of implication is understood.
+ // then expansion handles slowness of newness.
+ // this gives time for others to handle the newness: even your own brain,
+ // for possible errors. may be some error here, unsure.
+ //
+ // for one thing, this might help the structure of the system represent
+ // meaningful thought if it optimizes for speed
+
+ ref astate = makeconcept();
+ ref c = ctx;
+ bool cleanupcontext = false;
+ //if (c == nothing) {
+ // cleanupcontext = true;
+ // c = makeconcept();
+ //}
+ astate.set(context, c);
+ c.set(active-state, astate);
+ c.set(context, c);
+
+ if (s.linked(next-step)) {
+ astate.set(next-step, s.get(next-step));
+ }
+ while (astate.linked(next-step) && astate.get(next-step) != nothing) {
+ s = astate.get(next-step);
+ astate.set(active-step, s);
+ astate.set(next-step, s.linked(next-step) ? s.get(next-step).ptr() : nothing.ptr());
+ // if needed-map, load subcontext
+ ref subctx = c;
+ std::cerr << "<<";
+ for (auto link : c.links()) {
+ std::cerr << " " << link.first.name() << ":" << link.second.name();
+ }
+ std::cerr << std::endl;
+ if (s.linked(needed-map)) {
+ subctx = makeconcept();
+ contextmapinto(c, s.get(needed-map), subctx);
+ subctx.set(outer-context, c);
+ subctx.set(active-state, astate);
+ subctx.set(context, subctx);
+ astate.set(context, subctx);
+ ref::context() = subctx;
+ }
+ subctx.set("self", s.get(action));
+ s.get(action).fun<ref>()(subctx); // <-- maybe we should check arguments
+ if (s.linked(made-map)) {
+ contextmapinto(subctx, s.get(made-map), c);
+ }
+ if (s.linked(needed-map)) {
+ c = subctx.get(outer-context);
+ ref::context() = c;
+ astate.set(context, c);
+ conceptunmake(subctx);
+ }
+ }
+ c.unlink(active-state, astate);
+ conceptunmake(astate);
+ if (cleanupcontext) { conceptunmake(c); }
+}
+
+void _condition(ref ctx, ref cond, ref steps, ref state)
+{
+ // because this sets active-state's next-step instead of calling something,
+ // a subcontext is not opened for the steps unless they have one.
+ ref next = nothing;
+ if (!steps.linked(cond)) {
+ if (steps.linked("anything")) {
+ next = steps["anything"];
+ } else {
+ throw makeconcept().link(
+ is, "unknown-condition",
+ "condition", cond,
+ "next-steps", steps,
+ "context", ctx);
+ }
+ } else {
+ next = steps[cond];
+ }
+
+ if (next != nothing) {
+ state.set("next-step", next);
+ }
+}
+
void createhabits()
{
// making new information should delay, for learning with good curve.
@@ -117,7 +219,12 @@ void createhabits()
{
t.ptr()->data = s.ptr()->data;
});
- ahabit(concept-unmake, ((concept, c)), { conceptunmake(c); });
+ ahabit(concept-unmake, ((last-context, c), (concept-name, n)),
+ {
+ ref r = c.get(n);
+ c.unlink(n);
+ conceptunmake(r);
+ });
ahabit(concept-crucial, ((concept, c)),
{
result = c.crucial();
@@ -372,12 +479,7 @@ void createhabits()
decls(needed, made, known, information, translation);
ahabit(make-translation-map, ((translation-map, m), (known-map, k, nothing)),
{
- result = makeconcept();
- result.link(
- //habit, translation-map,
- translation, m
- );
- if (k != nothing) { result.link(known, k); }
+ result = maketranslationmap(m, k);
});
ahabit(context-map-into, ((source-context, c1), (translation-map, m), (target-context, c2)),
{
@@ -400,23 +502,23 @@ void createhabits()
});
*/
decls(step, previous);
- ahabit(make-context-action, ((previous-step, ps), (known-information, literals), (needed-information-map, in), (made-information-map, out), (action, act)),
+ ahabit(make-context-step, ((previous-step, ps), (known-information, literals), (needed-information-map, in), (made-information-map, out), (action, act)),
{
if (ps != nothing && ps.linked(next-step)) { throw makeconcept().link(is, "previous-step-already-has-next-step", previous-step, ps, context, ctx); }
- result = makeconcept();
+ result = intellect::level1::a("context-step");
result.link(
//habit, context-action,
- needed-map, (make-translation-map)(in, literals),
- made-map, (make-translation-map)(out),
+ needed-map, maketranslationmap(in, literals),
+ made-map, maketranslationmap(out),
action, act);
if (ps != nothing) { ps.set(next-step, result); }
});
decls(order, steps);
// make steps doesn't allow for name, and isn't used in level2.cpp <====
- ahabit(make-steps, ((information-order, io, nothing)),
+ ahabit(make-steps, ((existing-concept, nam, nothing), (information-order, io, nothing)),
{
- result = makeconcept();
+ result = (nam == nothing) ? makeconcept() : nam;
ref infn = intellect::level1::a(habit-information-needed);
result.set(information-needed, infn);
ref posinf = infn;
@@ -438,70 +540,19 @@ void createhabits()
result.ptr()->data = steps.ptr()->data;
});
- decls(active, outer);
+ decls(active, outer, state);
ahabit(steps, (),
{
- ref s = self;
- // PLEASE RUN SYSTEM WITH PROPER DELAY WHILE IT LEARNS (see top of file)
- // until similarity is understood, new information shuold be slowest thing
- // to produce.
- // then, similar information until expansion of implication is understood.
- // then expansion handles slowness of newness.
- // this gives time for others to handle the newness: even your own brain,
- // for possible errors. may be some error here, unsure.
- //
- // for one thing, this might help the structure of the system represent
- // meaningful thought if it optimizes for speed
-
- ref state = makeconcept();
- ref c = ctx;
- bool cleanupcontext = false;
- //if (c == nothing) {
- // cleanupcontext = true;
- // c = makeconcept();
- //}
- state.set(context, c);
- c.set(active-state, state);
- c.set(context, c);
-
- if (s.linked(next-step)) {
- state.set(next-step, s.get(next-step));
- }
- while (state.linked(next-step) && state.get(next-step) != nothing) {
- s = state.get(next-step);
- state.set(active-step, s);
- state.set(next-step, s.linked(next-step) ? s.get(next-step).ptr() : nothing.ptr());
- // if needed-map, load subcontext
- ref subctx = c;
- if (s.linked(needed-map)) {
- subctx = makeconcept();
- contextmapinto(c, s.get(needed-map), subctx);
- subctx.set(outer-context, c);
- subctx.set(active-state, state);
- subctx.set(context, subctx);
- subctx.set(self, action);
- state.set(context, subctx);
- }
- state.get(action).fun<ref>()(subctx); // <-- maybe we should check arguments
- if (s.linked(made-map)) {
- contextmapinto(subctx, s.get(made-map), c);
- }
- if (s.linked(needed-map)) {
- c = subctx.get(outer-context);
- conceptunmake(subctx);
- }
- }
- conceptunmake(state);
- if (cleanupcontext) { conceptunmake(c); }
+ _steps(self, ctx);
});
decls(condition);
// steps must be actual steps, not a list of steps
- ahabit(make-condition-action, ((previous-step, ps), (condition, cond), (steps, s, nothing)),
+ ahabit(make-condition-step, ((previous-step, ps), (condition, cond), (steps, s, nothing)),
{
if (ps != nothing && ps.linked(next-step)) { throw makeconcept().link(is, "previous-step-already-has-next-step", previous-step, ps, context, ctx); }
if (s == nothing) { s = makeconcept(); }
- result = makeconcept().link(
- needed-map, (make-translation-map)(makeconcept().link(cond, condition), makeconcept().link(next-steps, s)),
+ result = intellect::level1::a("condition-step").link(
+ needed-map, maketranslationmap(makeconcept().link(condition, cond), makeconcept().link(next-steps, s)),
action, condition
);
if (ps != nothing) { ps.set(next-step, result); }
@@ -512,27 +563,10 @@ void createhabits()
});
ahabit(condition, ((condition, cond), (next-steps, steps), (active-state, state)),
{
- // because this sets active-state's next-step instead of calling something,
- // a subcontext is not opened for the steps unless they have one.
- ref next = nothing;
- if (!steps.linked(cond)) {
- if (linked(steps, "anything")) {
- next = steps["anything"];
- } else {
- throw makeconcept().link(
- is, "unknown-condition",
- "condition", cond,
- "next-steps", steps,
- context, ctx);
- }
- } else {
- next = steps[cond];
- }
-
- if (next != nothing) {
- state.set(next-step, next);
- }
+ _condition(ctx, cond, steps, state);
});
+
+
/*(
ahabit(context-action, ((context, outerctx), (action, ca)),
{
diff --git a/starts/meaning-vm/level-2/habits.hpp b/starts/meaning-vm/level-2/habits.hpp
index 8e2f65c..d5fb0fd 100644
--- a/starts/meaning-vm/level-2/habits.hpp
+++ b/starts/meaning-vm/level-2/habits.hpp
@@ -9,6 +9,9 @@ namespace level2 {
void createhabits();
+ref makeconcept();
+void conceptunmake(ref c);
+
namespace concepts {
// make a link
diff --git a/starts/meaning-vm/level1.cpp b/starts/meaning-vm/level1.cpp
index 628fc1e..a2046d2 100644
--- a/starts/meaning-vm/level1.cpp
+++ b/starts/meaning-vm/level1.cpp
@@ -53,7 +53,7 @@ int main()
}
);
- std::cout << (make-linked).dump("dumped", true) << std::endl;
+ std::cout << (make-linked).dump("dumped") << std::endl;
decls(apple, fruit);
(make-linked)[act]
@@ -64,7 +64,7 @@ int main()
C, fruit
));
- std::cout << apple.dump("dumped", true) << std::endl;
+ std::cout << apple.dump("dumped") << std::endl;
std::cout << intellect::level0::allocated() << " allocated" << std::endl;
while (true) {
diff --git a/starts/meaning-vm/level2.cpp b/starts/meaning-vm/level2.cpp
index e2dd8b9..0a4e16c 100644
--- a/starts/meaning-vm/level2.cpp
+++ b/starts/meaning-vm/level2.cpp
@@ -37,7 +37,7 @@ ref makelist(std::initializer_list<ref> items)
ref makestep(ref habit, std::initializer_list<ref> resultandins)
{
// build needed-information-map, made-information-map, action
- // then pass to make-context-action.
+ // then pass to make-context-step.
ref nim = (make-concept)(), mim = (make-concept)(), ki = (make-concept)();
(know-is-list)(nim); (know-is-list)(mim), (know-is-list)(ki);
if (result != nothing) {
@@ -55,7 +55,7 @@ ref makestep(ref habit, std::initializer_list<ref> resultandins)
(make-next-list-entry)(nim, (make-map-item)(in, infn[information]));
}
}
- return (make-context-action)(ki, nim, mim, habit);
+ return (make-context-step)(ki, nim, mim, habit);
}
#define step(action, ...) makestep(action, ref("nothing"), { symbolstorefs(__VA_ARGS__) })
#define fromstep(result, action, ...) makestep(action, ref(#result), { symbolstorefs(__VA_ARGS__) })
@@ -74,17 +74,26 @@ ref knowisactionlist(ref src, std::initializer_list<ref> steps)
#define symboltostr(sym) #sym
#define commasymboltostr(sym) , #sym
+ref makequicklist(ref linktype, std::initializer_list<char const *> items)
+{
+ ref ret = makeconcept();
+ for (auto item : items) {
+ ret.link(linktype, item);
+ }
+ return ret;
+}
+
ref makestep(ref last, ref action, std::initializer_list<char const *> resultandins)
{
- ref lits = (make-concept)();
- ref vars = (make-concept)();
- ref outs = (make-concept)();
+ ref lits = makeconcept();
+ ref vars = makeconcept();
+ ref outs = makeconcept();
ref infn = action.get(information-needed);
bool processedresult = false;
for (auto str : resultandins) {
if (!processedresult) {
if (ref(str) != nothing) {
- outs.set("result", str);
+ outs.set(str, "result");
}
processedresult = true;
continue;
@@ -101,21 +110,21 @@ ref makestep(ref last, ref action, std::initializer_list<char const *> resultand
vars.link(infn[information], str);
}
}
- return ref("make-context-action")(last, lits, vars, outs, action);
+ return ref("make-context-step")(last, lits, vars, outs, action);
}
#include <cassert>
// make functions and macros to make behaviors
-#define begin(name) { ref BEHAVIOR(#name); ref last = BEHAVIOR;
+#define begin(name, ...) { ref BEHAVIOR(#name); ref("make-steps")(BEHAVIOR, makequicklist(ref("information-order"), { symbolstostrs(__VA_ARGS__)})); ref last = BEHAVIOR;
#define end(nam) assert(BEHAVIOR.name() == #nam); }
#define rewire(name) last = name; last.unlink("next-step");
#define wire(name) last.set("next-step", name)
#define label(name) ref name =
#define step(action, ...) last = makestep(last, ref(#action), { symbolstostrs(nothing,##__VA_ARGS__) })
#define assign(result, action, ...) last = makestep(last, ref(#action), { symbolstostrs(result,##__VA_ARGS__) })
-#define jmpeq(var, cnst, label) last = ref("make-condition-action")(last, ref(#var), ref("make-concept")().link(ref(#cnst), label, ref("anything"), ref("nothing"))
-#define jmpne(var, cnst, label) last = ref("make-condition-action")(last, ref(#var), ref("make-concept")().link(ref(#cnst), ref("nothing"), ref("anything"), label)
-#define cond(var) last = ref("make-condition-action")(last, ref(#var), ref("make-concept")().link(ref("anything"), ref("nothing")))
+#define jmpeq(var, cnst, label) last = ref("make-condition-step")(last, ref(#var), makeconcept().link(ref(#cnst), label, ref("anything"), ref("nothing"))
+#define jmpne(var, cnst, label) last = ref("make-condition-step")(last, ref(#var), makeconcept().link(ref(#cnst), ref("nothing"), ref("anything"), label)
+#define cond(var) last = ref("make-condition-step")(last, ref(#var), makeconcept().link(ref("anything"), ref("nothing")))
#define condadd(cond, val, step) ref("condition-action-add")(cond, ref(#val), step)
//#define ifelse(var, cnst, ifcond, elsecond)
// make sequence for ifcond
@@ -148,8 +157,8 @@ int main()
decls(dump, name, of, is, nothing);
ahabit(name-of, ((concept, c)),
{
- if (linked(c, name)) {
- result = get(c, name);
+ if (c.linked(name)) {
+ result = c.get(name);
} else {
for (auto & group : c.getAll(is)) {
result = (name-of)(group);
@@ -163,12 +172,12 @@ int main()
}
ss << "-" << std::hex << (size_t)(c.ptr());
intellect::level1::givename(c, ss.str());
- result = get(c, name);
+ result = c.get(name);
}
});
ahabit(write-name, ((concept, c)),
{
- std::cout << (name-of)(c);
+ std::cout << (name-of)(c).val<std::string>();
});
ahabit(write-endl, (),
{
@@ -183,7 +192,7 @@ int main()
link("the-set", c, true);
});
// I guess I'd better code dump as a behavior.
- begin(dump);
+ begin(dump, concept);
// hey ask the opencoggers if they have a syntax sugar library
// they must if they built a whole robot
// no reply on opencog chat. could check hansen robotics repo or ml.
@@ -204,13 +213,15 @@ int main()
condadd(whilecond, true, ifhastarget);
assign(link-type, get, link-entry, `type);
step(write-name, link-type);
+ step(write-name, `: `);
assign(link-target, get, link-entry, `target);
step(write-name, link-target);
step(write-endl);
step(next-link-entry, link-entry);
wire(whilelabel);
rewire(whilecond);
- step(concept-unmake, link-entry);
+ step(concept-unmake, context, `link-entry);
+ //std::cerr << intellect::level1::dump(whilecond, makeconcept(), makeconcept()) << std::endl;
assign(link-entry, make-first-link-entry, concept);
label(whilelabel2) assign(has-target, linked, link-entry, `target);
label(whilecond2) cond(has-target);
@@ -223,7 +234,7 @@ int main()
step(next-link-entry, link-entry);
wire(whilelabel2);
rewire(whilecond2);
- step(concept-unmke, link-entry);
+ step(concept-unmake, context, `link-entry);
end(dump);
/*
// for dump, we make a list of contextual actions
@@ -247,5 +258,13 @@ int main()
}
});
*/
- dump(dump);
+ try {
+ // for some reason it's only running the second loop
+ // nothing is output on the first
+ std::cerr << intellect::level1::dump(dump, makeconcept()) << std::endl;
+ dump(dump);
+ } catch(intellect::level1::ref r) {
+ std::cerr << intellect::level1::ref(r.ptr()).dump(makeconcept()) << std::endl;
+ throw;
+ }
}
diff --git a/starts/meaning-vm/makefile b/starts/meaning-vm/makefile
index b2df672..6e03081 100644
--- a/starts/meaning-vm/makefile
+++ b/starts/meaning-vm/makefile
@@ -13,10 +13,12 @@ liblevel2.a: $(patsubst %.cpp,%.o,$(wildcard level-0/*.cpp)) $(patsubst %.cpp,%.
habit-starts/rhythm: habit-starts/rhythm.o liblevel2.a
+-include $(patsubst %.cpp,%.d,$(wildcard level-0/*.cpp) $(wildcard level-1/*.cpp) $(wildcrd level-2/*.cpp) $(wildcard level*.cpp))
+
%.o: %.ii
- $(CXX) $(CXXFLAGS) -c $^ -o $@
-%.ii: %.cpp
- $(CXX) $(CPPFLAGS) $(CXXFLAGS) -E $< -o $@
+ $(CXX) $(CXXFLAGS) -c $*.ii -o $*.o
+%.ii %.d: %.cpp
+ $(CXX) $(CPPFLAGS) $(CXXFLAGS) -MMD -MQ $*.ii -E $*.cpp -o $*.ii
.INTERMEDIATE: $(patsubst %.cpp,%.ii,$(wildcard */*.cpp) $(wildcard *.cpp))
level-0/%.ii: $(wildcard level-0/*.hpp)
@@ -28,4 +30,4 @@ level-2/%.ii: $(wildcard level-0/*.hpp) $(wildcard level-1/*.hpp) $(wildcard lev
ranlib $@
clean:
- -rm *.ii *.o level? *.a */*.o */*.ii
+ -rm *.ii *.o level? *.a */*.o */*.ii *.d */*.d