Discuss Scratch
- Discussion Forums
- » Suggestions
- » Importing and Exporting lists - separators between indices
- Blaze349
-
Scratcher
1000+ posts
Importing and Exporting lists - separators between indices
Currently the lists are separated with the newline chara cter ‘/n’. This makes it more difficult than it needs to be to import an array from a map-making program or from any program. In most C-based programming languages, lists are separated with commas. This also makes it easier to quickly look at an entire list on a single screen.
This suggestion is not about how lists are displayed in Scratch but how the are exported in the .txt files.
Current Scratch list export style:
New way:
Choose.
EDIT: No one has mentioned this issue.
This suggestion is not about how lists are displayed in Scratch but how the are exported in the .txt files.
Current Scratch list export style:
1
2
3
4
5
6
New way:
1, 2, 3, 4, 5, 6
Choose.
EDIT: No one has mentioned this issue.
1,2,3,'hello, jack', ‘hey’The comma in Jack should not be treated a separator because it is inside two quotes. Also, we can escape it with a backslash.
Last edited by Blaze349 (July 5, 2017 11:24:31)
- Galleigo
-
Scratcher
500+ posts
Importing and Exporting lists - separators between indices
support. nothin much to say.
- walkcycle
-
Scratcher
500+ posts
Importing and Exporting lists - separators between indices
Each item in a Scratch list is on a new line. So the way export does it now retains the info in the original better.
- Romi67
-
Scratcher
27 posts
Importing and Exporting lists - separators between indices
How could a Scratch project be able to export a .txt file in the first place?
- Blaze349
-
Scratcher
1000+ posts
Importing and Exporting lists - separators between indices
Each item in a Scratch list is on a new line. So the way export does it now retains the info in the original better.I'm having trouble understanding the second sentence but the separating character is not important to the Scratch parser. Changing the separating character will not increase the amount of bytes the list uses nor will it decrease the speed of parsing. Instead, it will make it easier for us to easily port arrays from our other programs into Scratch.
- Blaze349
-
Scratcher
1000+ posts
Importing and Exporting lists - separators between indices
How could a Scratch project be able to export a .txt file in the first place?Right click on the any list in a scratch project and choose export. It automatically exports the list as a .txt file.
- walkcycle
-
Scratcher
500+ posts
Importing and Exporting lists - separators between indices
It is important to how Scratch lists are. The other programs you use should be able to easily change the delimiter character in a CSV file.
I could support adding an ‘all’ value to
to report a list with comma separated values.
I could support adding an ‘all’ value to
(item (all v) of [list v] :: list)
to report a list with comma separated values.
- Blaze349
-
Scratcher
1000+ posts
Importing and Exporting lists - separators between indices
It is important to how Scratch lists are. The other programs you use should be able to easily change the delimiter character in a CSV file.
I could support adding an ‘all’ value to(item (all v) of [list v] :: list)
to report a list with comma separated values.
I think you are confused as to what I am suggesting. I'm suggesting that, when the lists are exported but not in the Scratch enviroment, that they should be separated with commas rather than the newline character ('\n'). This has nothing to do with CSV files or scratch blocks.
- Galleigo
-
Scratcher
500+ posts
Importing and Exporting lists - separators between indices
It is important to how Scratch lists are. The other programs you use should be able to easily change the delimiter character in a CSV file.also known as
I could support adding an ‘all’ value to(item (all v) of [list v] :: list)
to report a list with comma separated values.
(list :: list)
- walkcycle
-
Scratcher
500+ posts
Importing and Exporting lists - separators between indices
when the lists are exported but not in the Scratch enviroment, that they should be separated with commas rather than the newline character ('\n').
The other programs you use should be able to easily do this.
- Blaze349
-
Scratcher
1000+ posts
Importing and Exporting lists - separators between indices
There isn't a reason why we need to constantly do this. All the ST needs to do is to change one character in their code.when the lists are exported but not in the Scratch enviroment, that they should be separated with commas rather than the newline character ('\n').
The other programs you use should be able to easily do this.
- walkcycle
-
Scratcher
500+ posts
Importing and Exporting lists - separators between indices
also known asIf it does comma separated values each time, then the ‘all’ is not needed.(list :: list)
- walkcycle
-
Scratcher
500+ posts
Importing and Exporting lists - separators between indices
There isn't a reason why we need to constantly do this. All the ST needs to do is to change one character in their code.Each item in a Scratch list is on a new line. So the way import and export does it is consistent.
- Blaze349
-
Scratcher
1000+ posts
Importing and Exporting lists - separators between indices
I've explained to you that it is irrelevant to the way the list is rendered. Code shouldn't care how a function is implemented but instead what it does. Not how it does it.There isn't a reason why we need to constantly do this. All the ST needs to do is to change one character in their code.Each item in a Scratch list is on a new line. So the way import and export does it is consistent.
- walkcycle
-
Scratcher
500+ posts
Importing and Exporting lists - separators between indices
The format of the inputs and outputs of code are important. Yes, Scratch could import and export in other formats. But because lists are done as each item on a separate line in Scratch, it exports to a text file that directly represents this. And to be consistent, it imports from the same format.
- Blaze349
-
Scratcher
1000+ posts
Importing and Exporting lists - separators between indices
But because lists are done as each item on a separate line in Scratch, it exports to a text file that directly represents this. .So because lists are graphically displayed as lines then they should use a new line a separator in the file?
- Sheep_maker
-
Scratcher
1000+ posts
Importing and Exporting lists - separators between indices
Wouldn't Scratch also have to escape commas and quotes? The current method doesn't need escaping (unless it's being stored in the project.json) since list items can't have newlines.
- Blaze349
-
Scratcher
1000+ posts
Importing and Exporting lists - separators between indices
Wouldn't Scratch also have to escape commas and quotes? The current method doesn't need escaping (unless it's being stored in the project.json) since list items can't have newlines.So? It is relatively easy to implement this, compared to most suggestions.
- Raman15
-
Scratcher
100+ posts
Importing and Exporting lists - separators between indices
How could a Scratch project be able to export a .txt file in the first place?Well you see inside, right click on the list and press export, I actually made a tool that lets you do it ingame
- Discussion Forums
- » Suggestions
-
» Importing and Exporting lists - separators between indices