> Thanks alot!
> It worked corectly very nice.
> Thanks you again.
> Only one problem remained.
> If pattern-matching was true and pattern matched with facts in
> knowledge base, I want in out put only 5 facts (for example) be
> printout for ?name, not all of them. (Meaning only 5 phones be
> recommended to users not all phones are matched)
> I used (while), but this way was incorrect.
> Nima
> On Mar 15, 7:08 pm, CLIPS Support <garydri...@gmail.com> wrote:
> > Read through section 6 of the Basic Programming Guide which describes
> > how globals work:http://clipsrules.sourceforge.net/OnlineDocs.html
> > Use facts to pass information from one rule to another:
> > (defrule Questions
> > (declare (salience 20))
> > =>
> > (bind ?response
> > (ask-question "2- What Is Your Favorite OS? (A/B/C)" "A.
> > Android B. Windows C. Symbian" a b c))
> > (if (eq ?response a)
> > then
> > (assert (OS Android))))
> > (defrule Result
> > (Mobile ?name ?OS)
> > (OS ?OS)
> > =>
> > (printout t ?name))
> > On Mar 15, 3:23 am, Nima <divoone0...@gmail.com> wrote:
> > > Hi all,
> > > I have a problem that can not find any reason for it!
> > > in a pattern-matching, when I use a variable that Initialized
> > > manually, pattern-matching work correctly.
> > > But when use a variable that Initialized by binding, pattern-matching
> > > doesn't work.
> > > for example, first code, return 72 and work correctly:
> > > first code:
> > > --------------------------------------------------------------------------
> > > (deffunction Pass-Search (?x)
> > > ?x)
> > > (defglobal ?*OS* = Android)
> > > (deffacts Mobile
> > > (Mobile 71 Symbian)
> > > (Mobile 72 Android))
> > > (defrule Result
> > > (Mobile ?name =(Pass-Search ?*OS*))
> > > =>
> > > (printout t ?name))
> > > --------------------------------------------------------------------------- -
> > > But when ?*OS* gets its value from user by using binding, it doesn't
> > > work correctly:
> > > --------------------------------------------------------------------------- ---
> > > (deffunction Pass-Search (?x)
> > > ?x)
> > > (defglobal ?*OS* = Android)
> > > (deffacts Mobile
> > > (Mobile 71 Symbian)
> > > (Mobile 72 Android))
> > > (defrule Questions
> > > (declare (salience 20))
> > > =>
> > > (bind ?response
> > > (ask-question "2- What Is Your Favorite OS? (A/B/C)" "A.
> > > Android B. Windows C. Symbian" a b c))
> > > (if (eq ?response a)
> > > then
> > > (bind ?*OS* Android)))
> > > (defrule Result
> > > (Mobile ?name =(Pass-Search ?*OS*))
> > > =>
> > > (printout t ?name))
> > > --------------------------------------------------------------------------- -----------------
> > > ask-question is one of my functions.
> > > I hope someone can help me.
> > > Nima