Topic Missing quotes on string elements of lists expresses my surprise on the output of user-message [“1” “2” “3”]' not showing the quotes.
@ERSUCC suggested to write a function to do the conversion.
I have called the function repr in analogy with Python’s function for a similar purpose.
It turned out that the function needs a string substitution function, which I could not find in NetLogo.
So, the accompanying include file constains function substitute as well as function repr.
Feel free to include this file in any NetLogo models.
Formally, I have put the code under GPL license. (Without a license, it is formally free-for-nobody…)
2 Likes
There was a small style issue in the code. I have removed the file from the previous post.
Here is the corrected version instead:
repr-tool.nls (2.9 KB)
1 Like
(Second attempt; the forum mangled one of the files after correcting a flaw…)
And now (using 7.1.0-alpha1) the same code as a module.
(Unfortunately, this forum does not accept .nlm files, yet. So, please strip .txt after downloading…)
Also included three versions of the test code, one using __includes (for the file above), two using import.
test-repr-includes.nlogox (3.1 KB)
test-repr-import-selected.nlogox (3.1 KB)
test-repr-import-module.nlogox (3.1 KB)
repr-tool.nlm.txt (3.0 KB)
2 Likes