Discuss Scratch

CAT_SPRITE
Scratcher
19 posts

Arrays

My suggestion is a new type of data called Arrays, which is used by most programming languages. It could be implemented into lists or could be a new data type along with variables and lists.

Here are a few blocks that could be used if arrays are added

adding
add [thing] to [array list v]
add [thing] to column (1 v) of [array list v]

deleting
delete (1 v) of [array v]
delete column (1 v) row (1 v) of [array v]

inserting
insert [thing] at (1 v) of [array list v]
insert [thing] at column (1 v) row (1 v) of [array list v]

replacing
replace item (1 v) of [array list v] with [thing]
replace column (1 v) row (1 v) of [array list v] with [thing]

variable data
data (item (1 v) of [array list v])
data (item column (1 v) row (1 v) of [array list v])
data (length of [array list v])
data (length of item (1 v) [array list v])

boolean data
data <[array list v] contains [thing]?>
data <column (1 v) of [array list v] contains [thing]?>
data <row (1) of [array list v] contains [thing]?>
Could return null ^

It wouldn't be like a table, but each column with have their own amount of rows

(Life)
Not_Me_You_Me_Me
Scratcher
100+ posts

Arrays

No support, I don't really see how this would be used, but either way it's too complex (or I'm dumb, one or the other.)

<~^w^~::operators>// This is predicat, she protects me from evil kumquats and also people who think she's called a boolean.
DaEpikDude
Scratcher
1000+ posts

Arrays

Arrays are generally just a list of some number of dimensions. Assuming this is talking about 2D arrays for the most part, I'd like to have that but I think they should be called something different (I think a “table” would be a good Scratch-esque term)

And all the world over, each nation's the same,
They've simply no notion of playing the game.
They argue with umpires, they cheer when they've won,
And they practice beforehand, which ruins the fun!
Za-Chary
Scratcher
1000+ posts

Arrays

Semi-support. A 2D Array, or an array of arrays (or even a “table” as @DaEpikDude mentioned), would be pretty helpful for Scratch projects, provided that they are made with intuitive, easy-to-use-blocks.

You seem to have quite a lot of blocks for just a 2D array, so I think you could probably condense them a bit. There definitely should not be more blocks than there are for 1D arrays.

This is my forum signature! On a forum post, it is okay for Scratchers to advertise in their forum signature. The signature is the stuff that shows up below the horizontal line on the post. It will show up on every post I make.

I was a Scratch Team member from May 10th 2019 to October 29th 2021.

my notebook | scratch team essay | accessibility essay
DaEpikDude
Scratcher
1000+ posts

Arrays

Za-Chary wrote:

Semi-support. A 2D Array, or an array of arrays (or even a “table” as @DaEpikDude mentioned), would be pretty helpful for Scratch projects, provided that they are made with intuitive, easy-to-use-blocks.

You seem to have quite a lot of blocks for just a 2D array, so I think you could probably condense them a bit. There definitely should not be more blocks than there are for 1D arrays.
I imagine the new blocks would probably be something like:

add [...] to row (1 v) of [table v]::list // would have an "all" option (add an item to every row)

delete (1 v) of row (1 v) of [table v]::list

insert [...] at row (1 v) column (1 v) of [table v]::list

replace item in row (1 v) column (1 v) of [table v] with [...] ::list

(item in row (1 v) column (1 v) of [table v]::list)

<row (1 v) of [table v] contains [item]?::list> // would have an "any" option in the row (checks if it's anywhere in the table)

Pretty much just the normal list blocks except now it has a row and column input instead of just an item number. (You could make columns the main thing but I think making it rows makes more sense: e.g. in Python you take the “row” first and then the “column”)

And all the world over, each nation's the same,
They've simply no notion of playing the game.
They argue with umpires, they cheer when they've won,
And they practice beforehand, which ruins the fun!
Za-Chary
Scratcher
1000+ posts

Arrays

DaEpikDude wrote:

Za-Chary wrote:

Semi-support. A 2D Array, or an array of arrays (or even a “table” as @DaEpikDude mentioned), would be pretty helpful for Scratch projects, provided that they are made with intuitive, easy-to-use-blocks.

You seem to have quite a lot of blocks for just a 2D array, so I think you could probably condense them a bit. There definitely should not be more blocks than there are for 1D arrays.
I imagine the new blocks would probably be something like:

add [...] to row (1 v) of [table v]::list // would have an "all" option (add an item to every row)

delete (1 v) of row (1 v) of [table v]::list

insert [...] at row (1 v) column (1 v) of [table v]::list

replace item in row (1 v) column (1 v) of [table v] with [...] ::list

(item in row (1 v) column (1 v) of [table v]::list)

<row (1 v) of [table v] contains [item]?::list> // would have an "any" option in the row (checks if it's anywhere in the table)

Pretty much just the normal list blocks except now it has a row and column input instead of just an item number. (You could make columns the main thing but I think making it rows makes more sense: e.g. in Python you take the “row” first and then the “column”)
This looks great! I'm not sure if they're the most intuitive thing possible, but I can't think of any way to make it easier…plus, lists are probably some of the more complicated parts of Scratch.

This is my forum signature! On a forum post, it is okay for Scratchers to advertise in their forum signature. The signature is the stuff that shows up below the horizontal line on the post. It will show up on every post I make.

I was a Scratch Team member from May 10th 2019 to October 29th 2021.

my notebook | scratch team essay | accessibility essay

Powered by DjangoBB