What is 'split by' block with a CSV option good for?

You can copy and paste an entire table into the 'split () by' block and it will generate a native Snap! table, which is essentially a list of lists.

I just learned this, playing with ChatGPT and telling it to create a CSV-formatted table.

Use "Copy code" (which in this case copies the table) and paste it into the

[scratchblocks]
(split [ ] by [csv v]::operators)
[/scratchblocks]

And, voilà, when the block is run, its output will be a native Snap! table, i.e list of lists.

the resulting list of lists

The resulting Snap!table can then be a value that The Beatles variable could be set to.

Now, many things could be done, all at once, by using the map () over (table); including:

  • changing the order of the columns
  • leaving some columns out
  • adding new columns

rearranged columns

In the example above, the all but first of () block skipped the first row that contained the column headings.

Using an additional list block inside the map 's grey ring, the order was changed, so that the surname column is the first one now, while the name column is now at the second place; and, at the third place, the new column containing an enumeration, was added.

The values of the third column were formed by an open parenthesis, "(", followed by the index of, applied to all but the first row in The Beatles table, and then a closing parenthesis, ")".

Make sure to add parenthesis so it becomes a reporter:

[scratchblocks]
(split [    ] by [csv v]::operators)
[/scratchblocks]

[scratchblocks]
(split [ ] by [csv v]::operators)
[/scratchblocks]

You can also just use :: reporter

[scratchblocks]
split [    ] by [csv v]::operators reporter
[/scratchblocks]

[scratchblocks]
split [ ] by [csv v]::operators reporter
[/scratchblocks]

@joecooldoo and @ego-lay_atman-bay - I've made the suggested correction. Thank you!