diff options
-rw-r--r-- | CORE1.cpp | 38 | ||||
-rw-r--r-- | README.md | 5 | ||||
-rw-r--r-- | dylfunc_call.cpp | 9 | ||||
-rw-r--r-- | dylfunc_compile.cpp | 10 | ||||
-rw-r--r-- | pgsql_connect.cpp | 9 | ||||
-rw-r--r-- | simple_recv.cpp | 13 | ||||
-rw-r--r-- | simple_send.cpp | 10 |
7 files changed, 88 insertions, 6 deletions
@@ -69,6 +69,7 @@ using namespace opencog; void atomtest() { AtomSpace as; + // Handle subclasses a shared_ptr to Atom Handle h = as.add_node(CONCEPT_NODE, "Cat"); HandleSeq hseq = {h, h}; Handle dumbInheritance = as.add_link(INHERITANCE_LINK, hseq); @@ -159,7 +160,7 @@ void atomtest() // - ADD CODE TO ATOMS // we will want a sequence of substeps // raw strings interspersed with variable references - // - OUTPUT ATOMSPACE to see how it looks + // - OUTPUT ATOMSPACE to see how it looks <-- this was just to help a different state of work // - IMPLEMENT SOLVER USING PATTERNS // will need a way to // - get patterns matching requests @@ -465,9 +466,40 @@ int main() // map similarity between the structures of interacting with peers, and internal // structures. -// ONCE YOU CAN THINK: +// AFTER YOU CAN THINK RELIABLY: // when you find a good choice, be sure to use it to research how to make the bad // choice just as good. ((all things have inherent value)) -// be sure to generalize pattern work, with simple processes that work for many forms +// be sure to generalize patterns and pattern work,w/ simple processes that work for many forms + +// CUR TASK: send and receive a simple goal with habit to reach goal +// this is a subtask of process optimization +// it is communication between subprocesses +// +// goal: communicate with other process +// +// pre: +// $x is a process +// $y is a process +// $z is information +// $x knows $z +// $y does not know $z +// +// post: +// $y knows $z +// +// habit: <code reference> +// +// we'll need a step reserializer. +// way to merge serialization and deserialization? +// 1. form patterns mapping between the two +// 2. make a general reserialization process that makes the missing pattern exist +// <let's keep send/recv separate for now, but make this for +// line-meaning> + +// CORE ROLES: +// - group learning: research how to research stuff +// - diversity: brainstorm new parts of learning to be researched +// - implement processes researching the parts of learning brainstormed +// @@ -10,10 +10,9 @@ and it must be able to refer to itself usefully. 1. Choose a simple algorithm for collecting steps together to perform a task. 2. Choose a simple representation of steps to use for #1. 3. Implement #2 enough to use it to communicate a step to another process. - Once #3 works, the goal now is to efficiently produce a form of #1 as a collection of -processes that can develop themselves, so make sure to reuse your work, and do work that is -reusable, as much as possible. +processes that can develop themselves, using each other as their steps. Make sure to +reuse your work, and do work that is reusable, as much as possible. 4. Choose a simple algorithm for handling if something horrible goes wrong that must never be repeated (trauma). Consider storing a detailed log forever. Consider refusing to diff --git a/dylfunc_call.cpp b/dylfunc_call.cpp new file mode 100644 index 0000000..bbd2ea7 --- /dev/null +++ b/dylfunc_call.cpp @@ -0,0 +1,9 @@ +// this process loads a dynamic library built by dylfunc_compile +// and executes it with the passed data + +// we are moving towards judging that we no longer need dynamic loading +// and could just compile new code ... it seems valuable but slow-start. +// why not just build processes? +// need to structure input and output +// +// okay, let's look into atomspace serialization diff --git a/dylfunc_compile.cpp b/dylfunc_compile.cpp new file mode 100644 index 0000000..9023f97 --- /dev/null +++ b/dylfunc_compile.cpp @@ -0,0 +1,10 @@ + +// this process builds a dynamic library wrapping other code + +extern "C" void dylfunc_compile(<context>) +{ + // write a dylfunc for passed context content + // compile it with g++ -shared -fPIC source.cpp -o source.so +} + + diff --git a/pgsql_connect.cpp b/pgsql_connect.cpp new file mode 100644 index 0000000..bcf5852 --- /dev/null +++ b/pgsql_connect.cpp @@ -0,0 +1,9 @@ +// this process / function connects to a postgresql atomspace backend, creating it if needed + +#include <opencog/atomspace/AtomSpace.h> + +extern "C" void pgsql_connect(opencog::Handle name) +{ + // TODO: please install postgresql-server + // then follow instructions in src/atomspaces/opencog/persist/sql/README.md +} diff --git a/simple_recv.cpp b/simple_recv.cpp new file mode 100644 index 0000000..4f82ab3 --- /dev/null +++ b/simple_recv.cpp @@ -0,0 +1,13 @@ +// receives information as a text line on stdin +// works on StringValue 'text' + +#include <opencog/atomspace/Handle.h> +#include <iostream> + +extern "C" void simple_recv(opencog::Handle data) +{ + std::string s(4096); + std::cin.getline(&s[0], s.size(), std::endl); + opencog::Handle text = data.getAtomSpace()->add_node(opencog::STRING_VALUE, "text"); + data.setValue(text, new opencog::StringValue(s)); +} diff --git a/simple_send.cpp b/simple_send.cpp new file mode 100644 index 0000000..62820a0 --- /dev/null +++ b/simple_send.cpp @@ -0,0 +1,10 @@ +// sends information as a text line on stdout +// works on StringValue 'text' + +#include <opencog/atomspace/Handle.h> +#include <iostream> +extern "C" void simple_send(opencog::Handle data) +{ + opencog::Handle text = data.getAtomSpace()->add_node(opencog::STRING_VALUE, "text"); + std::cout << data.getValue(text).to_string() << std::endl; +} |