gama-platform / gama.old

Main repository for developing the 1.x versions of GAMA
GNU General Public License v3.0
304 stars 99 forks source link

Wrong result with the "split_with(string ...)" operator #3311

Closed ptaillandier closed 1 year ago

ptaillandier commented 2 years ago

Describe the bug Test the following expression: write "333%444" split_with "%%";

It should returns a list composed of only one element ["333%444"]. Instead GAMA returns ['333','444']

Desktop (please complete the following information):

AlexisDrogoul commented 2 years ago

Actually no. If you look at the doc, it rightly says : Returns a list containing the sub-strings (tokens) of the left-hand operand delimited by each of the characters of the right-hand operand To use the whole string as a delimiter, you have to use the second form of split_with with a boolean argument set to true. i.e: write "333%444" split_with ("%%", true);

ptaillandier commented 2 years ago

Very interesting. However, for me, the default behavior should be "333%444" split_with ("%%", true) to be consistent with older versions of GAMA and because it seems to be a lot more natural for modelers who are not computer scientists :) .

AlexisDrogoul commented 2 years ago

Should I mention who implemented this operator like this in 2018 ?? 🤣

(https://github.com/gama-platform/gama/commit/c9d2a09186ebc2bb9b2fb74588bd54f4c4f4d48e)

ptaillandier commented 2 years ago

2018 .... it is very recent considering the long history of GAMA 😅

Le jeu. 3 mars 2022 à 10:09, Alexis Drogoul @.***> a écrit :

Should I mention who implemented this operator like this in 2018 ?? 🤣

(c9d2a09 https://github.com/gama-platform/gama/commit/c9d2a09186ebc2bb9b2fb74588bd54f4c4f4d48e )

AlexisDrogoul commented 2 years ago

Maybe. But the important thing to consider is the who ^^

AlexisDrogoul commented 2 years ago

So I let you decide whether to close it or change your implementation 😀

AlexisDrogoul commented 1 year ago

Let's close this issue -- everything works as intended !