Skip to content

Commit

Permalink
Fixes wrong assumption on casting agent to string
Browse files Browse the repository at this point in the history
  • Loading branch information
lesquoyb committed May 22, 2024
1 parent 431892c commit d361097
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 7 deletions.
4 changes: 1 addition & 3 deletions gama.core/tests/Basic Tests/models/Lists.experiment
Original file line number Diff line number Diff line change
Expand Up @@ -243,9 +243,7 @@ experiment Lists type:test {
l2 <<+ my_agents collect each.name;
assert l2 = ['dummy0','dummy1','dummy2','dummy3','dummy4'];

// // ... or, even simpler (since the casting of an agent to string returns its name)
assert list<string>(my_agents) = ['dummy0','dummy1','dummy2','dummy3','dummy4'];
// // Powerful filter expressions can be built by combining the various 'iterator' operators
// Powerful filter expressions can be built by combining the various 'iterator' operators
let l3 <- list<string>(my_agents where even(int(each))) collect ("Agent " + each + " has an even id");
assert l3 = ['Agent dummy(0) has an even id','Agent dummy(2) has an even id','Agent dummy(4) has an even id'];
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -288,11 +288,9 @@ species looping_on_lists {
l2 <- [];
l2 <<+ my_agents collect each.name;
write sample(l2);
// ... or, even simpler (since the casting of an agent to string returns its name)
list<string> l3 <- list<string>(my_agents);
write sample(l3);

// Powerful filter expressions can be built by combining the various 'iterator' operators
l3 <- list<string>(my_agents where even(int(each))) collect ("Agent " + each + " has an even id");
list<string> l3 <- list<string>(my_agents where even(int(each))) collect ("Agent " + each + " has an even id");
write sample(l3);
}
}
Expand Down

0 comments on commit d361097

Please sign in to comment.