Closed KonstSkouras closed 1 year ago
Hi Skouras,
thanks for reporting this issue. It is indeed a bug! I am still thinking on how to solve it. Unfortunately it is more difficult to solve than a thought.
Meanwhile, you can use a "non for" version of your code:
+!initializeMapNoFor(MO,N) <-
.map.create(MO);
.map.put(MO,1,2);
!initializeMapNoFor(MO,1,N);
.print(MO).
+!initializeMapNoFor(MO,V,N) : V > N.
+!initializeMapNoFor(MO,V,N) <-
.map.put(MO,V,V);
!initializeMapNoFor(MO,V+1,N).
A tentative to fix the bug is available in the "develop" branch of Jason. I will not place the fix in the master branch for now since it is a bit "experimental". If you use gradle to run your system, the release 3.1-SNAPSHOT contains this fix.
Thank you for your replies!
Hi,
I'm trying to dynamically initialize a Map, in JASON 3.0 as follows:
However, the result is the following
So, it seems like when using the put operation in the for loop, a new map is created instead of updating the existing one. Is this the intended behavior? And if so, is there any way to dynamically update an existing map?