#include "level-2/level-2.hpp" #include "level-1/level-1.hpp" #include #include using namespace intellect::level2; using namespace intellect::level2::concepts; int main() { decls(dump, name, of, is, nothing); ahabit(name-of, ((concept, c)), { if (linked(c, name)) { result = get(c, name); } else { for (auto & group : c.getAll(is)) { result = (name-of)(group); if (result != nothing) { break; } } std::stringstream ss; if (result != nothing) { ss << result.val(); } else { ss << "unnamed"; } ss << "-" << std::hex << (size_t)(c.ptr()); intellect::level1::givename(c, ss.str()); result = get(c, name); } }); // I guess I'd better code dump as a behavior. ahabit(dump, ((concept, c)), { decls(type, target); static std::set dumped; if (dumped.count(c) == 0) { std::cout << (name-of)(c).val() << ":" << std::endl; dumped.insert(c); ref le = (make-concept)().act(know-is-first-link-entry, c); while (le.linked(target)) { std::cout << " " << (name-of)(le.get(type)).val() << ": " << (name-of)(le.get(target)).val() << std::endl; (next-link-entry)(le); } (know-is-first-link-entry)(le, c); while (le.linked(target)) { (dump)(le.get(target)); (next-link-entry)(le); } (unmake-concept)(le); } }); }