From: Helio H. L. <hel...@gm...> - 2019-10-28 18:09:33
|
Great, this is what I was trying to do. Thank you very much!! -- Helio Henrique L. C. Monte-Alto Em seg, 28 de out de 2019 às 15:01, Jomi Hubner <jom...@gm...> escreveu: > Hi Helio, > > Variables do not change the value in Jason (as in Prolog) — they are more > like math vars, and less like a programming vars. So, in your code, the > value of L is set as [] and cannot change later. > > If you want to build lists from Belief Base, I’d suggest to use .findall: > > .findall( focus_rule(H,B), focus_rule(H,B), L); > .send(A, tell, L). > > HTH, > > Jomi > > > > On 28 Oct 2019, at 14:10, Helio Henrique Lopes <hel...@gm...> > wrote: > > > > Thanks Jomi, > > > > So I think I did not understand how to capture de predicates into the > variables (unification). Can I do something like this? > > > > /* Beliefs (the ones that I want to transmit to other agents) /* > > focus_rule(mushroom(m1), [death_cap(m1)]) > > focus_rule(mushroom(m1), [caesar_mushroom(m1)]) > > > > /* Action plan. Get every belief 'focus_rule(...)' and send them to > agent A. */ > > +!query(P, A): <- > > L = [] > > for (focus_rule(H,B)) { > > X = focus_rule(H,B); > > L = [X|L]; > > }; > > .send(A, tell, L). > > > > I am sorry if this question is very basic or simple, but I really did > not see similar examples. > > > > Thanks!! > > > > -- > > Helio Henrique L. C. Monte-Alto > > > > Em seg, 28 de out de 2019 às 13:51, Jomi Hubner <jom...@gm...> > escreveu: > > Hello Helio, > > > > It is quite simple: just send a list of predicates, as in > > > > .send(bob,tell,[a,b,c]). > > > > HTH, > > > > Jomi > > > > > On 28 Oct 2019, at 12:02, Helio Henrique Lopes < > hel...@gm...> wrote: > > > > > > Hello, > > > > > > I have a case in which I want an agent to send a list of beliefs to > another agent. I want to do it in one single message, thus the idea is > sending a predicate containing, among other things, this list of > predicates. What would be the best way to do this? > > > > > > Thanks, > > > Helio > > > _______________________________________________ > > > Jason-users mailing list > > > Jas...@li... > > > https://lists.sourceforge.net/lists/listinfo/jason-users > > > > |