OpenCog Framework
Branch: master, revision 6f0b7fc776b08468cf1b74aa9db028f387b4f0c0
|
#include <PutLink.h>
Additional Inherited Members | |
![]() | |
typedef std::shared_ptr< InSet > | InSetPtr |
![]() | |
HandleSeq | _varseq |
std::map< Handle, unsigned int > | _index |
![]() | |
HandleSeq | _outgoing |
![]() | |
UUID | _uuid |
AtomTable * | _atomTable |
Type | _type |
char | _flags |
TruthValuePtr | _truthValue |
AttentionValuePtr | _attentionValue |
std::mutex | _mtx |
InSetPtr | _incoming_set |
The PutLink implements a beta redex; it is similar to an imperative version of MemberLink, with argumets reversed.
A beta redex is a concatentation or composition of two expressions, one with N free variables in it, and a list of N values for those variables. The natural form for a beta redex is in the unreduced form: the values are not (yet) substituted for the variables; they are simply sitting there, ready and waiting for that reduction to happen.
Thus, the PutLink makes use of the FreeLink to identify the free variables. It also overloads it's reduce() method, which implements the actual beta reduction. The reduce() method only performs the substitution; it does not attempt to execute or evaluate the resulting expression.
|
protected |
Definition at line 45 of file PutLink.cc.
References opencog::classserver(), and init().
|
protected |
Definition at line 55 of file PutLink.cc.
References opencog::classserver(), and init().
|
protected |
Definition at line 65 of file PutLink.cc.
References opencog::classserver(), and init().
PutLink::PutLink | ( | const HandleSeq & | oset, |
TruthValuePtr | tv = TruthValue::NULL_TV() , |
||
AttentionValuePtr | av = AttentionValue::DEFAULT_AV() |
||
) |
Definition at line 29 of file PutLink.cc.
References init().
PutLink::PutLink | ( | const Handle & | a, |
TruthValuePtr | tv = TruthValue::NULL_TV() , |
||
AttentionValuePtr | av = AttentionValue::DEFAULT_AV() |
||
) |
Definition at line 37 of file PutLink.cc.
References init().
PutLink::PutLink | ( | Link & | l | ) |
Definition at line 75 of file PutLink.cc.
References opencog::classserver(), opencog::Atom::getType(), and init().
|
protected |
Definition at line 224 of file PutLink.cc.
References opencog::Link::_outgoing, opencog::FreeLink::_varseq, createLink, opencog::Atom::getType(), opencog::Atom::Handle, opencog::LinkCast(), and substitute_nocheck().
|
protected |
PutLink expects a very strict format: an arity-2 link, with the first part being a pattern, and the second a list or set of values. If the pattern has N variables, then the seccond part must have N values. The following formats are understood:
PutLink <pattern with 1 variable> <any single="" atom>="">
PutLink <pattern with="" n="" variables>=""> ListLink ;; must have arity N <atom 1> ... <atom n>="">
The below is a handy-dandy easy-to-use form. When it is reduced, it will result in the creation of a set of reduced forms, not just one (the two sets haveing the same arity). Unfortunately, this trick cannot work for N=1.
PutLink <pattern with="" n="" variables>=""> SetLink ;; Must hold a set of ListLinks ListLink ;; must have arity N <atom 1> ... <atom n>="">
Definition at line 115 of file PutLink.cc.
References opencog::Link::_outgoing, opencog::FreeLink::_varseq, opencog::FreeLink::build_index(), opencog::FreeLink::find_vars(), opencog::Atom::getType(), and opencog::LinkCast().
|
virtual |
Reimplemented from opencog::FreeLink.
Definition at line 253 of file PutLink.cc.
References do_reduce().
Perform the actual beta reduction –
Substitute values for the variables in the pattern tree. This is a lot like applying the function fun to the argument list args, except that no actual evaluation is performed; only substitution. The resulting tree is NOT placed into any atomspace, either. If you want that, you must do it youself. If you want evaluation or execution to happen during or after sustitution, use either the EvaluationLink, the ExecutionOutputLink, or the Instantiator.
So, for example, if this PutLink looks like this:
PutLink EvaluationLink PredicateNode "is a kind of" ListLink VariableNode $a ConceptNode "hot patootie" ConceptNode "cowpie"
then the reduced value will be
EvaluationLink PredicateNode "is a kind of" ListLink ConceptNode "cowpie" ConceptNode "hot patootie"
Again, only a substitution is performed, there is no evaluation. Note also that the resulting tree is NOT placed into any atomspace!
Definition at line 198 of file PutLink.cc.
References opencog::FreeLink::_index, createLink, opencog::Atom::getType(), opencog::Atom::Handle, and opencog::LinkCast().