From: Stephen C. <ste...@ot...> - 2018-07-13 02:31:55
|
Hi Jomi, Thanks for your quick response. That seems to have solved the problem. I tested it using JEdit after updating the JEdit plugin in my Jason 2.2 installation (i.e. I downloaded http://jacamo.sourceforge.net/maven2/org/jason-lang/jason/2.3-SNAPSHOT/jason-2.3-SNAPSHOT.jar and copied its jason folder into jason-jedit-plugin.jar (to overwrite the one that was in there). Regards, Stephen -----Original Message----- From: Jomi Hubner <jom...@gm...> Sent: Friday, 13 July 2018 1:43 AM To: Stephen Cranefield <ste...@ot...> Cc: jas...@li... Subject: Re: [Jason-users] Bug in the conversion of plan strings to terms hi Stephen, thanks for reporting this bug. Indeed it impacts drastically in plan exchange. I hope I fixed it properly, it is committed in Jason at github. If you use maven, you can get the fix by using the SNAPSHOT version of jason available at url: http://jacamo.sourceforge.net/maven2/ compile group: 'org.jason-lang', name: 'jason' , version: '2.3-SNAPSHOT’ HTH, Jomi > On 11 Jul 2018, at 23:24, Stephen Cranefield <ste...@ot...> wrote: > > There seems to be a bug when a string representing a plan term is converted back into a term. The code below retrieves a plan using .relevant_plans, converts that to a string using .term2string, and then converts the resulting string back to a new plan term. > > !start. > > +!start <- > .relevant_plans({+!say_hello}, [Plan|_]); > .print("Plan term:\n", Plan); > .term2string(Plan, PlanAsString); > .print("Plan string:\n", PlanAsString); > .term2string(UnstringifiedPlan, PlanAsString); > .print("Plan term converted from string:\n", UnstringifiedPlan); > .send(recipient, tellHow, Plan); > .send(recipient, achieve, say_hello). > > +!say_hello <- > ?.my_name(Me); > .println("Hello from ", Me). > > > This is the output (note the last line, in which a single variable has now become two separate ones): > > Plan term: > { @l__2 +!say_hello <- .my_name(_34Me); .println("Hello from ",_34Me) } > Plan string: > { @l__2 +!say_hello <- .my_name(_34Me); .println("Hello from ",_34Me) } > Plan term converted from string: > { @l__2 +!say_hello <- .my_name(_35_34Me); .println("Hello from ",_36_34Me) } > > This is not just an issue of how the term is printed. Sending the plan to another agent via .send(recipient, tellHow, UnstringifiedPlan) and then calling .send(recipient, achieve, say_hello) results in the following output (showing that the plan really does contain two separate variables now): > > Hello from _36_34Me<no-value> > > I am using Jason 2.2. > > Regards, > Stephen > > > > ------------------------------------------------------------------------------ > Check out the vibrant tech community on one of the world's most > engaging tech sites, Slashdot.org! http://sdm.link/slashdot > _______________________________________________ > Jason-users mailing list > Jas...@li... > https://lists.sourceforge.net/lists/listinfo/jason-users -- Jomi Fred Hubner Department of Automation and Systems Engineering Federal University of Santa Catarina PO Box 476, Florianópolis, SC 88040-900 Brazil http://jomi.das.ufsc.br -- be good. be kind. be happy. (Conrad Anker) |