您当前的位置:首页 > IT编程 > C++
| C语言 | Java | VB | VC | python | Android | TensorFlow | C++ | oracle | 学术与代码 | cnn卷积神经网络 | gnn | 图像修复 | Keras | 数据集 | Neo4j | 自然语言处理 | 深度学习 | 医学CAD | 医学影像 | 超参数 | pointnet | pytorch | 异常检测 | Transformers | 情感分类 | 知识图谱 |

自学教程:C++ unify函数代码示例

51自学网 2021-06-03 09:09:59
  C++
这篇教程C++ unify函数代码示例写得很实用,希望能帮到您。

本文整理汇总了C++中unify函数的典型用法代码示例。如果您正苦于以下问题:C++ unify函数的具体用法?C++ unify怎么用?C++ unify使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。

在下文中一共展示了unify函数的30个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的C++代码示例。

示例1: trace

bool reasoner::unify ( predicate* _s, const subst& ssub, predicate* _d, subst& dsub, bool f ) {	if ( !_s && !_d ) {		trace ( "Match two nulls." << endl );		return true;	}//	if ( !_s ) return _d && _d->pred >= 0; // ??//	if ( !_d ) return _s && _s->pred >= 0; // ??	predicate& s = *_s;	predicate& d = *_d;	trace ( "/tUnify s: " << s << " in " << ( ssub ) << " with " << d << " in " << dsub << endl );	//	if (s.pred == d.pred) trace("we have local pred match"<<endl);	predicate* p;	if ( s.pred < 0 ) {		if (( p = evaluate ( s, ssub ) )) return unify ( p, ssub, _d, dsub, f );		else {			trace ( "Match." << endl );			return true;		}	}	if ( d.pred >= 0 ) {		if ( s.pred != d.pred || s.args.size() != d.args.size() ) return false;		const predlist& as = s.args, ad = d.args;		for ( auto sit = as.begin(), dit = ad.begin(); sit != as.end(); ++sit, ++dit )			if ( !unify ( *sit, ssub, *dit, dsub, f ) )				return false;		trace ( "Match." << endl );		return true;	}	p = evaluate ( d, dsub );	if ( ( p = evaluate ( d, dsub ) ) ) return unify ( _s, ssub, p, dsub, f );	if ( f ) dsub[d.pred] = evaluate ( s, ssub );	trace ( "Match with subst: " << dsub << endl );	return true;}
开发者ID:lnovy,项目名称:tauchain,代码行数:34,


示例2: forward_chaining

		boost::optional< substitution > forward_chaining( const atomic_sentence & sen )		{			for ( const atomic_sentence & se : known_facts )			{				auto ret = unify( se, sen );				if ( ret ) { return ret; }			}			bool have_new_inference = true;			std::set< std::string > var_name = variable_name( );			while ( have_new_inference )			{				have_new_inference = false;				for ( const definite_clause & dc : kb )				{					assert( ! dc.premise.empty( ) );					substitution rename =							rename_variable(								dc.premise.begin( ),								dc.premise.end( ),								[&]( const std::string & v ){ return var_name.count( v ) == 0; },								[]( const std::string & n ){ return n + "_"; } );					have_new_inference = try_infer_forward( dc.premise, dc.conclusion, rename, sen ) || have_new_inference;					auto ret = unify( known_facts.back( ), sen );					if ( ret ) { return ret; }				}			}			return boost::optional< substitution >( );		}
开发者ID:NicozRobin,项目名称:first_order_logic_prover,代码行数:28,


示例3: subst

frame* reasoner::match_cases ( frame& current_frame, predicate& t, cases_t& cases, deque<frame*>& queue ) {	if ( cases.find ( t.pred ) == cases.end() ) return 0;	uint src = 0;	for ( rule* _rl : cases[t.pred] ) {		rule& rl = *_rl;		src++;		ground_t ground = current_frame.ground;		if ( rl.body.empty() )			ground.emplace_back ( &rl, subst() );		frame& candidate_frame = frames[nframes++].init ( this, &rl, src, 0, &current_frame, subst(), ground );		if ( unify ( &t, current_frame.substitution, rl.head, candidate_frame.substitution, true ) ) {			trace ( "unification of rule " << rl << " from cases against " << t << " passed" << endl );			frame& ep = current_frame;			while ( ep.parent ) {				ep = *ep.parent;				if ( ( ep.src == current_frame.src ) &&				        unify ( ep.rul->head, ep.substitution, current_frame.rul->head, current_frame.substitution, false ) )					break;			}			if ( !ep.parent ) {				//	cout << "pushing frame: " << candidate_frame << endl;//				return 				queue.push_front(&candidate_frame);			}		} else {			trace ( "unification of rule " << rl << " from cases against " << t << " failed" << endl );		}	}	return 0;}
开发者ID:lnovy,项目名称:tauchain,代码行数:31,


示例4: unify

/* * This wordlist check is now the least important given the checks above * and the support for passphrases (which are based on dictionary words, * and checked by other means).  It is still useful to trap simple short * passwords (if short passwords are allowed) that are word-based, but * passed the other checks due to uncommon capitalization, digits, and * special characters.  We (mis)use the same set of words that are used * to generate random passwords.  This list is much smaller than those * used for password crackers, and it doesn't contain common passwords * that aren't short English words.  Perhaps support for large wordlists * should still be added, even though this is now of little importance. */static const char *is_word_based(const passwdqc_params_qc_t *params,    const char *needle, const char *original, int is_reversed){	char word[7];	char *unified;	unsigned int i;	int length;	int mode;	if (!params->match_length)	/* disabled */		return NULL;	mode = is_reversed | 2;	for (i = 0; i < sizeof(seq) / sizeof(seq[0]); i++) {		unified = unify(NULL, seq[i]);		if (!unified)			return REASON_ERROR;		if (is_based(params, unified, needle, original, mode)) {			free(unified);			return REASON_SEQ;		}		free(unified);	}	mode = is_reversed | 1;	word[6] = '/0';	for (i = 0; i < 0x1000; i++) {		if (params->lang == 0) {			memcpy(word, _passwdqc_wordset_4k[i], 6);		} else {			memcpy(word, _passwdqc_wordset_4k_es[i], 6);		}		length = strlen(word);		if (length < params->match_length)			continue;		if (params->lang == 0 && i < 0xfff &&		    !memcmp(word, _passwdqc_wordset_4k[i + 1], length))			continue;		if (params->lang == 1 && i < 0xfff &&		    !memcmp(word, _passwdqc_wordset_4k_es[i + 1], length))			continue;		unify(word, word);		if (is_based(params, word, needle, original, mode))			return REASON_WORD;	}	mode = is_reversed | 2;	if (params->match_length <= 4)	for (i = 1900; i <= 2039; i++) {		sprintf(word, "%u", i);		if (is_based(params, word, needle, original, mode))			return REASON_SEQ;	}	return NULL;}
开发者ID:javierwilson,项目名称:passwdqc,代码行数:68,


示例5: unify

void unify(char x[],char y[]){char a[100],b[100];		if(strcmp(theta,"FAILURE")==0)		return;	if(strcmp(x,y)==0)		return;	else if(isvariable(x))		unify_var(x,y);	else if(isvariable(y))		unify_var(x,y);	else if(iscompound(x) && iscompound(y))	{				strcpy(a,arg(x));		strcpy(b,arg(y));		unify(a,b);		strcpy(a,op(x));		strcpy(b,op(y));		unify(a,b);	}	else if(islist(x) && islist(y))	{		strcpy(a,rest(x));		strcpy(b,rest(y));		unify(a,b);				strcpy(a,first(x));		strcpy(b,first(y));		unify(a,b);	}		else 		sprintf(theta,"FAILURE",theta);	return;}
开发者ID:vin18,项目名称:Programs,代码行数:50,


示例6: main

intmain(void){    char buf[50];    char cmd[10];    int p , q;    init(array);    while( fgets(buf , 49 , stdin) != NULL )    {        if(sscanf(buf , "%s %d %d" , cmd , &p , &q) == 3)        {            if(strcmp(cmd , "test") == 0)                test(p , q);            else if(strcmp(cmd , "unify") == 0)                unify(p , q);            else                printf("unknow operations/n");        }        else            printf("input error/n");    }    return 0;}
开发者ID:muryliang,项目名称:algorithmse,代码行数:25,


示例7: conflicts

staticClause conflicts(Clause a, Clause b){  if (!unit_clause(a) || !unit_clause(b))    return NULL;  else if (a->literals->sign == b->literals->sign)    return NULL;  else {    Clause empty = NULL;    Term a_atom = a->literals->atom;    Term b_atom = b->literals->atom;    Context ca = get_context();    Context cb = get_context();    Trail tr = NULL;    if (unify(a_atom, ca, b_atom, cb, &tr)) {      Ilist j = NULL;      undo_subst(tr);      empty = get_clause();      j = ilist_append(j, a->id);      j = ilist_append(j, 1);      j = ilist_append(j, b->id);      j = ilist_append(j, 1);      empty->justification = resolve_just(j, BINARY_RES_JUST);      upward_clause_links(empty);      assign_clause_id(empty);    }    free_context(ca);    free_context(cb);    return empty;  }}  /* conflicts */
开发者ID:Velrok,项目名称:SeminarArbeitMultiModalLogiken,代码行数:32,


示例8: isUnifyable

bool isUnifyable(const TypePtr& typeA, const TypePtr& typeB) {	if (typeA == typeB) {		return true;	}	NodeManager tmp; // requires only temporary manager	return unify(tmp, typeA, typeB);}
开发者ID:8l,项目名称:insieme,代码行数:7,


示例9:

  Router::Node* Router::Node::unify(Router::Node* const& root, Router::Node* const path, std::unordered_map<std::string, std::string>& params) {    if (Router::Node::unifiable(root, path)) {      if ((root->is_last() && (path->is_last() || root->is_splat())) ||          (path->is_last())) {        return root;      } else      if (root->is_last() && !path->is_last()) {        return nullptr;      }    }    Node* match;    for (auto next : root->children) {      if (!Router::Node::unifiable(next, path->next()))        continue;      if ((match = unify(next, path->next(), params)) != nullptr) {        if (match->service.empty())          continue;        next->inject(path->next(), params);        return match;      }    }    return nullptr;  }
开发者ID:mondieu,项目名称:rest-cpp,代码行数:27,


示例10: compose

/* compose -- evaluate a sequential composition or piping */PRIVATE env compose(tree t, env e, tok ldec, tok rdec, char *kind){     env e1 = tc_sexp(t->x_arg1, e);     env e2 = tc_sexp(t->x_arg2, e);     env ee = new_env(e);     def q;     /* Get vars from left arg that don't match */     for (;;) {	  def d = pop_def(e1);	  if (d == NULL) 	       break;	  else if (d->d_name->s_decor != ldec)	       push_def(d, ee);	  else {	       sym rname = mk_symbol(d->d_name->s_basename, rdec);	       type rtype = del_var(rname, e2);	       if (rtype == NULL)		    push_def(d, ee);	       else if (! unify(d->d_type, rtype)) {		    tc_error(t->x_loc, "Type mismatch in %s", kind);		    tc_e_etc("Expression: %z", t);		    tc_e_etc("Type of %n in LHS: %t", d->d_name, d->d_type);		    tc_e_etc("Type of %n in RHS: %t", rname, rtype);		    tc_e_end();	       }	  }     }     /* Now merge the unmatched vars from the right */     for (q = e2->e_defs; q != NULL; q = q->d_next)	  merge_def(VAR, q->d_name, q->d_type, ee, t, t->x_loc);     return ee;}
开发者ID:cherry-wb,项目名称:Hot-Fuzz,代码行数:36,


示例11: make_rotation

Matrix make_rotation ( Vector const& v_original, double a ){	Vector v(v_original);		a = deg_to_rad(a);	Vector u   = unify(v);	double c   = cos(a);	double s   = sin(a);	double omc = 1-c;	double ux  = u[0];	double uy  = u[1];	double uz  = u[2];	double ux2 = ux*ux;	double uy2 = uy*uy;	double uz2 = uz*uz;	double uxy = ux*uy;	double uxz = ux*uz;	double uyz = uy*uz;	double uxs = ux*s;	double uys = uy*s;	double uzs = uz*s;		double const values[16] = {		ux2+(1-ux2)*c, uxy*omc-uzs,   uxz*omc+uys,   0.0,		uxy*omc+uzs,   uy2+(1-uy2)*c, uyz*omc-uxs,   0.0,		uxz*omc-uys,   uyz*omc+uxs,   uz2+(1-uz2)*c, 0.0,		0.0,           0.0,           0.0,           1.0	};		return values;}
开发者ID:padde,项目名称:trayracer,代码行数:31,


示例12: mk_class_instance

optional<expr> mk_class_instance(environment const & env, io_state const & ios, local_context const & ctx,                                 name const & prefix, expr const & type, bool relax_opaque, bool use_local_instances,                                 unifier_config const & cfg) {    auto C = std::make_shared<class_instance_context>(env, ios, prefix, relax_opaque, use_local_instances);    if (!is_ext_class(C->tc(), type))        return none_expr();    expr meta       = ctx.mk_meta(C->m_ngen, some_expr(type), type.get_tag());    unsigned depth  = 0;    constraint c    = mk_class_instance_cnstr(C, ctx, meta, depth);    unifier_config new_cfg(cfg);    new_cfg.m_discard        = true;    new_cfg.m_use_exceptions = true;    new_cfg.m_pattern        = true;    new_cfg.m_kind           = C->m_conservative ? unifier_kind::VeryConservative : unifier_kind::Liberal;    try {        auto seq = unify(env, 1, &c, C->m_ngen.mk_child(), substitution(), new_cfg);        while (true) {            auto p = seq.pull();            lean_assert(p);            substitution s = p->first.first;            expr r = s.instantiate_all(meta);            if (!has_expr_metavar_relaxed(r))                return some_expr(r);            seq = p->second;        }    } catch (exception &) {        return none_expr();    }}
开发者ID:bmalehorn,项目名称:lean,代码行数:29,


示例13: immediate_depends_ptrlist

int immediate_depends_ptrlist(CTXTdeclc callnodeptr call1){  VariantSF subgoal;  int  count = 0;  CPtr oldhreg = NULL;  calllistptr cl;  reg[4] = makelist(hreg);  new_heap_free(hreg);  new_heap_free(hreg);  if(IsNonNULL(call1)){ /* This can be called from some non incremental predicate */    cl= call1->inedges;        while(IsNonNULL(cl)){      subgoal = (VariantSF) cl->inedge_node->callnode->goal;          if(IsNonNULL(subgoal)){/* fact check */	count++;	check_glstack_overflow(4,pcreg,2); 	oldhreg = hreg-2;	follow(oldhreg++) = makeint(subgoal);	follow(oldhreg) = makelist(hreg);	new_heap_free(hreg);	new_heap_free(hreg);      }      cl=cl->next;    }    if (count>0)      follow(oldhreg) = makenil;    else      reg[4] = makenil;  }  return unify(CTXTc reg_term(CTXTc 3),reg_term(CTXTc 4));}
开发者ID:De-Lac,项目名称:Dynamic-Verification-of-Service-Based-Systems,代码行数:33,


示例14: dfi

void ComplexInliner::immInline(BooleanDAG& dag){	map<string, int> fake;	DagFunctionInliner dfi(dag, functionMap, fake);	dfi.process(dag);		somethingChanged = dfi.changed();	if(mergeFunctions){			if(oldNfun > 0){			if( (dfi.nfuns() - oldNfun) > 3 && divFactor > (FRACTION + 1)){				divFactor--;				if( (dfi.nfuns() - oldNfun) > 12 ){					divFactor-= 4;									}				if( (dfi.nfuns() - oldNfun) > 40 ){					divFactor-= 4;									}				if(divFactor<(FRACTION + 1)){					divFactor = (FRACTION + 1);				}				cout<<"reducing divFactor "<<divFactor<<endl;			}		}		unifyTime.restart();		unify();		unifyTime.stop();		expectedNFuns++;	}	//cout<<" after all"<<endl;	oldNfun = dfi.nfuns();	Dout( cout<<" AFTER PROCESS "<<endl );	Dout(cout<<" end ElimFun "<<endl);}
开发者ID:Mestway,项目名称:Queries,代码行数:34,


示例15: match_pattern

bool match_pattern(type_checker & tc, expr const & pattern, declaration const & d, unsigned max_steps, bool cheap) {    name_generator ngen = tc.mk_ngen();     buffer<level> ls;    unsigned num_ls = d.get_num_univ_params();    for (unsigned i = 0; i < num_ls; i++)        ls.push_back(mk_meta_univ(ngen.next()));    expr dt        = instantiate_type_univ_params(d, to_list(ls.begin(), ls.end()));    unsigned num_e = get_expect_num_args(tc, pattern);    unsigned num_d = get_expect_num_args(tc, dt);    if (num_e > num_d)        return false;    for (unsigned i = 0; i < num_d - num_e; i++) {        dt         = tc.whnf(dt).first;        expr local = mk_local(ngen.next(), binding_domain(dt));        dt         = instantiate(binding_body(dt), local);    }    try {        unifier_config cfg;        cfg.m_max_steps            = max_steps;        cfg.m_kind                 = cheap ? unifier_kind::Cheap : unifier_kind::Liberal;        cfg.m_ignore_context_check = true;        auto r = unify(tc.env(), pattern, dt, tc.mk_ngen(), substitution(), cfg);        return static_cast<bool>(r.pull());    } catch (exception&) {        return false;    }}
开发者ID:cpehle,项目名称:lean,代码行数:28,


示例16: unify

frame* reasoner::next_frame ( const frame& current_frame, ground_t& g ) {	if ( !current_frame.rul->body.empty() ) g.emplace_front ( current_frame.rul, current_frame.substitution );	frame& new_frame = frames[nframes++].init ( this, *current_frame.parent );	new_frame.ground = g;	unify ( current_frame.rul->head, current_frame.substitution, new_frame.rul->body[new_frame.ind], new_frame.substitution, true );	new_frame.ind++;	return &new_frame;}
开发者ID:lnovy,项目名称:tauchain,代码行数:8,


示例17: main

int main(){	bool varying(4) b = { true, true, false, false };  store( b );	return unify( g, 1, 1, 0, 0 );}
开发者ID:sierra-lang,项目名称:libsierra,代码行数:8,


示例18: pl_consonne_1

pl_consonne_1 (struct coroutine *k, expr a0){expr nx[MAX_NEW_CONS];int pnx, i;struct process_list *alt_process;	pnx = 0;	begin_decl ();	decl_expr (&a0);	for (i=0; i<MAX_NEW_CONS; i++)		dle (nx[i]);#ifdef TRACE	printf ("/nconsonne: a0 = "); print_expr (a0);#endif	if (alt (k, 1, 0))	{	/* clause */	expr val_X, var_X;		alt_process = getpl (k) -> alt;		dle(val_X) dle(var_X)		val_X=UNDEF; var_X=mk_var(&val_X);#ifdef TRACE		printf ("/n/ta0 = "); print_expr (a0);#endif		unify (k, var_X, a0);		for (i=0; i<pnx; i++)			nx[i] = 0;		pnx=0;		pl_lettre_1 (k, var_X);		for (i=0; i<pnx; i++)			nx[i] = 0;		pnx=0;		pl_non_voyelle_1 (k, var_X);		for (i=0; i<pnx; i++)			nx[i] = 0;		pnx=0;		unify (k, a0, var_X);		for (i=0; i<pnx; i++)			nx[i] = 0;		pnx=0;#ifdef TRACE		printf ("/n/ta0 = "); print_expr (a0);#endif	} else	end (k);	free_expr ();}
开发者ID:jbailhache,项目名称:log,代码行数:46,


示例19: try_infer_forward

		bool try_infer_forward(				const std::vector< atomic_sentence > & premise,				const atomic_sentence & conclusion,				const substitution & rename,				const atomic_sentence & query )		{			bool ret = false;			std::vector< atomic_sentence > new_known_facts;			substitution s;			std::vector< atomic_sentence > gp;			auto generate =					[&,this]( const auto & self, const substitution & sub )->void					{						if ( gp.size( ) == premise.size( ) ) { new_known_facts.push_back( sub( rename( conclusion ) ) ); }						else						{							this->matching_facts(								rename( premise[ gp.size( ) ] ),								sub,								make_function_output_iterator(									[&]( const std::pair< atomic_sentence, substitution > & p )									{										if ( ( new_known_facts.empty( ) ) || ( ! unify( new_known_facts.back( ), query ) ) )										{											gp.push_back( p.first );											self( self, p.second );											gp.pop_back( );										}									} ) );						}					};			generate( generate, s );			for ( const atomic_sentence & sen : new_known_facts )			{				if ( std::none_of(						known_facts.begin( ),						known_facts.end( ),						[&]( const atomic_sentence & s ){ return unify( sen, s ); } ) )				{					known_facts.push_back( sen );					ret = true;				}			}			return ret;		}
开发者ID:NicozRobin,项目名称:first_order_logic_prover,代码行数:45,


示例20: keep

/* reg 1: tag for this call   reg 2: filter list of goals to keep (keep all if [])   reg 3: returned list of changed goals   reg 4: used as temp (in case of heap expansion) */int create_changed_call_list(CTXTdecl){  callnodeptr call1;  VariantSF subgoal;  TIFptr tif;  int j, count = 0,arity;  Psc psc;  CPtr oldhreg = NULL;  reg[4] = makelist(hreg);  new_heap_free(hreg);   // make heap consistent  new_heap_free(hreg);  while ((call1 = delete_calllist_elt(&changed_gl)) != EMPTY){    subgoal = (VariantSF) call1->goal;          tif = (TIFptr) subgoal->tif_ptr;    psc = TIF_PSC(tif);    if (in_reg2_list(CTXTc psc)) {      count++;      arity = get_arity(psc);      check_glstack_overflow(4,pcreg,2+arity*200); // guess for build_subgoal_args...      oldhreg = hreg-2;      if(arity>0){	sreg = hreg;	follow(oldhreg++) = makecs(hreg);	hreg += arity + 1;	new_heap_functor(sreg, psc);	for (j = 1; j <= arity; j++) {	  new_heap_free(sreg);	  cell_array1[arity-j] = cell(sreg-1);	}	build_subgoal_args(subgoal);		      }else{	follow(oldhreg++) = makestring(get_name(psc));      }      follow(oldhreg) = makelist(hreg);      new_heap_free(hreg);   // make heap consistent      new_heap_free(hreg);    }  }  if (count>0)    follow(oldhreg) = makenil;  else    reg[4] = makenil;       return unify(CTXTc reg_term(CTXTc 3),reg_term(CTXTc 4));  /*    int i;    for(i=0; i<callqptr; i++){      if(IsNonNULL(callq[i]) && (callq[i]->deleted==1)){    sfPrintGoal(stdout,(VariantSF)callq[i]->goal,NO);    printf(" %d %d/n",callq[i]->falsecount,callq[i]->deleted);    }    }  printf("-----------------------------/n");  */}
开发者ID:De-Lac,项目名称:Dynamic-Verification-of-Service-Based-Systems,代码行数:62,


示例21: main

int main(void) {    GC_INIT();    GREG g;     int jval, jval2;    char c;    sym_tab_init();    ast_init();    type_init();    scope_init();    rel_assign_init();    jit_t * jit = llvm_init();    yyinit(&g);    printf("Welcome to Cesium v 0.2/n");    printf("To exit press CTRL-D/n/n");    printf("> ");    while (1)    {       if (!(jval = setjmp(exc)))       {          if (!yyparse(&g))          {             printf("Error parsing/n");             abort();          } else if (root != NULL)          {             rel_stack_init();             rel_assign_mark();             scope_mark();             annotate_ast(root);             if (TRACE)                 ast_print(root, 0);             unify(rel_stack, rel_assign);             if (TRACE)                print_assigns(rel_assign);             exec_root(jit, root);             if (root->tag != AST_FNDEC)                 rel_assign_rewind();           }        } else if (jval == 1)              root = NULL;        else if (jval == 2)              break;        printf("/n> ");    }      yydeinit(&g);    llvm_cleanup(jit);    return 0;}
开发者ID:finbrein,项目名称:Cesium,代码行数:57,


示例22: unify_callback_wrapper

intunify_callback_wrapper (Termlist tl, struct state_mgu_tmp *ptr_tmpstate){  // now the keys are unified (subst in this tl)  // and we try the inner terms  assert (ptr_tmpstate != NULL);  return unify (ptr_tmpstate->unifyt1, ptr_tmpstate->unifyt2, tl,		ptr_tmpstate->oldcallback, ptr_tmpstate->oldstate);}
开发者ID:cascremers,项目名称:scyther,代码行数:9,


示例23: mindex_retrieve_next

/* PUBLIC */Term mindex_retrieve_next(Mindex_pos pos){  if (pos->index->unif_type == BACKTRACK_UNIF)    return retrieve_next_backtrack(pos);  else {    Term tq, tf;    Context cq, cf;    Trail tr;    BOOL ok;    tq = pos->query_term;    cq = pos->query_subst;    cf = pos->found_subst;    undo_subst(pos->tr);  /* ok if NULL or not used */    pos->tr = NULL;    tf = next_candidate(pos);    if (tf != NULL && pos->index->index_type == DISCRIM_BIND)       ok = TRUE;    else      ok = FALSE;    while (tf && !ok) {#if 0      printf("potential mate, %d: ", tf->INDEX_ID); p_term(tf);#endif	      tr = NULL;      switch (pos->query_type) {      case UNIFY:	ok = unify(tq, cq, tf, cf, &(pos->tr)); break;      case GENERALIZATION:	ok = match(tf, cf, tq, &(pos->tr)); break;      case INSTANCE:	ok = match(tq, cq, tf, &(pos->tr)); break;      case VARIANT:	ok = variant(tq, cq, tf, &(pos->tr)); break;      case IDENTICAL:	ok = term_ident(tq, tf); break;      default:	ok = FALSE; break;      }      if (!ok)	tf = next_candidate(pos);    }    if (ok) {#if 0      printf("          MATE, %d: ", tf->INDEX_ID); p_term(tf);#endif	      return tf;    }    else {      free_mindex_pos(pos);      return NULL;    }  }}  /* mindex_retrieve_next */
开发者ID:Velrok,项目名称:SeminarArbeitMultiModalLogiken,代码行数:58,


示例24: main

int main(){    bool varying(4) a = {true, true, false, false};    int  varying(4) b = {0, 3, 2, 3};    int varying(4) x = a ? b : 5;    return unify(x, 0, 3, 5, 5);}
开发者ID:sierra-lang,项目名称:libsierra,代码行数:9,


示例25: candidateSite

Type * SpCandidate::toType(SourceContext * source, BindingEnv & env) {  TypeDefn * tdef = cast<TypeDefn>(def_);  if (AnalyzerBase::analyzeTypeDefn(tdef, Task_PrepMemberLookup)) {    SourceContext candidateSite(tdef->location(), source, tdef, Format_Type);    relabelTypeVars(env);    if (unify(&candidateSite, env)) {      env.updateAssignments(source->location());      QualifiedTypeVarMap vars;      env.toTypeVarMap(vars, this);      return const_cast<Type *>(          tdef->templateSignature()->instantiateType(source->location(), vars));    } else {      unify(&candidateSite, env);      DFAIL("Unify failed...");    }  }  return NULL;}
开发者ID:afrog33k,项目名称:tart,代码行数:19,


示例26: unify

  Service::shared Router::find(Request::shared request, int worker_id) {    Node* node = unify(request->path, request->parameters);    if (node == nullptr)      return nullptr;    Service::shared service = node->find_service(worker_id);    return service;  }
开发者ID:mondieu,项目名称:rest-cpp,代码行数:10,


示例27: matching_facts

		ITER matching_facts( const atomic_sentence & match, const substitution & sub, ITER result ) const		{			for ( auto i = known_facts.begin( ); i != known_facts.end( ); ++i )			{				const auto & sen = * i;				assert( static_cast< bool >( sen.data ) );				auto res = unify( match, sen, sub );				if ( res ) { * result = std::make_pair( sen, * res ); }			}			return result;		}
开发者ID:NicozRobin,项目名称:first_order_logic_prover,代码行数:11,


示例28: f

void HuffmanCompression::compress(){    FileIO f("");    f.buildCharTable();    //f.browseHashTable();    list = new OrderedList;    list->insertMap(f.getMap());    copyExternalNodes();    unify(list->getFirst(),list->getFirst());    getCarEncode();    browseHashTable();}
开发者ID:bend,项目名称:Huffman-algorithm,代码行数:11,


示例29: immediate_inedges_list

/*For a callnode call1 returns a Prolog list of callnode on which call1immediately depends.*/int immediate_inedges_list(CTXTdeclc callnodeptr call1){  VariantSF subgoal;  TIFptr tif;  int j, count = 0,arity;  Psc psc;  CPtr oldhreg = NULL;  calllistptr cl;  reg[4] = makelist(hreg);  new_heap_free(hreg);  new_heap_free(hreg);  if(IsNonNULL(call1)){ /* This can be called from some non incremental predicate */    cl= call1->inedges;        while(IsNonNULL(cl)){      subgoal = (VariantSF) cl->inedge_node->callnode->goal;          if(IsNonNULL(subgoal)){/* fact check */	count++;	tif = (TIFptr) subgoal->tif_ptr;	psc = TIF_PSC(tif);	arity = get_arity(psc);	check_glstack_overflow(4,pcreg,2+arity*200); // don't know how much for build_subgoal_args...	oldhreg = hreg-2;	if(arity>0){	  sreg = hreg;	  follow(oldhreg++) = makecs(hreg);	  hreg += arity + 1;	  new_heap_functor(sreg, psc);	  for (j = 1; j <= arity; j++) {	    new_heap_free(sreg);	    cell_array1[arity-j] = cell(sreg-1);	  }			  build_subgoal_args(subgoal);			}else{	  follow(oldhreg++) = makestring(get_name(psc));	}	follow(oldhreg) = makelist(hreg);	new_heap_free(hreg);	new_heap_free(hreg);      }      cl=cl->next;    }    if (count>0)      follow(oldhreg) = makenil;    else      reg[4] = makenil;  }else{    xsb_warn("Called with non-incremental predicate/n");    reg[4] = makenil;  }  return unify(CTXTc reg_term(CTXTc 3),reg_term(CTXTc 4));}
开发者ID:De-Lac,项目名称:Dynamic-Verification-of-Service-Based-Systems,代码行数:57,


示例30: from_path

  Router::Node* Router::Node::unify(Router::Node* const& root, std::string const& path, std::unordered_map<std::string, std::string>& params) {    Node* node = from_path(path);    Node* match = unify(root, node, params);    delete node;    // if (match != nullptr) {    //   std::cout << "Matched '"<< path <<"' to '"<<match->uri()<<"'/n";    // }    return match;  }
开发者ID:mondieu,项目名称:rest-cpp,代码行数:12,



注:本文中的unify函数示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。


C++ unimpl函数代码示例
C++ uniform_random函数代码示例
万事OK自学网:51自学网_软件自学网_CAD自学网自学excel、自学PS、自学CAD、自学C语言、自学css3实例,是一个通过网络自主学习工作技能的自学平台,网友喜欢的软件自学网站。