Discuss Scratch

Monniasza_spzoo
Scratcher
100+ posts

Nested lists

Treemaps, hashtables and hash-nested lists have their threads and are closely related.
UnconstructivePoster
New Scratcher
100+ posts

Nested lists

Maybe instead of all those new blocks, we could make it so you can put “(item ( v) of (list v))” into the list dropdown if that particular item is a nested list?

add [thing] to (item (1 v) of [list v])

insert [thing] at (1 v) of (item (1 v) of [list v])

replace item (1 v) of (item (1 v) of [list v]) with [thing]

(item (1 v) of (item (1 v) of [list v]) :: list) // and so on

As for actually adding lists to lists, I like @testingscratcher's suggestion of making the list block return a list instead of a string.

add (nested list :: list) to [list v]

insert (nested list :: list) at (1 v) of [list v]

replace item (1 v) of [list v] with (nested list :: list)
Monniasza_spzoo
Scratcher
100+ posts

Nested lists

UnconstructivePoster wrote:

Maybe instead of all those new blocks, we could make it so you can put “(item ( v) of (list v))” into the list dropdown if that particular item is a nested list?

add [thing] to (item (1 v) of [list v])

insert [thing] at (1 v) of (item (1 v) of [list v])

replace item (1 v) of (item (1 v) of [list v]) with [thing]

(item (1 v) of (item (1 v) of [list v]) :: list) // and so on

As for actually adding lists to lists, I like @testingscratcher's suggestion of making the list block return a list instead of a string.

add (nested list :: list) to [list v]

insert (nested list :: list) at (1 v) of [list v]

replace item (1 v) of [list v] with (nested list :: list)
Both methods should be implemented.
Monniasza_spzoo
Scratcher
100+ posts

Nested lists

What color these blocks should be?

I think about this:
Nested lists :: #ff0000
Nested Hashtables :: #ff0040
Hash-nested lists :: #ff4000
Multi-hashtables :: #ff8040
Treemaps :: #ff8080

Last edited by Monniasza_spzoo (Aug. 24, 2019 15:35:59)

Monniasza_spzoo
Scratcher
100+ posts

Nested lists

UnconstructivePoster wrote:

Maybe instead of all those new blocks, we could make it so you can put “(item ( v) of (list v))” into the list dropdown if that particular item is a nested list?

add [thing] to (item (1 v) of [list v])

insert [thing] at (1 v) of (item (1 v) of [list v])

replace item (1 v) of (item (1 v) of [list v]) with [thing]

(item (1 v) of (item (1 v) of [list v]) :: list) // and so on

As for actually adding lists to lists, I like @testingscratcher's suggestion of making the list block return a list instead of a string.

add (nested list :: list) to [list v]

insert (nested list :: list) at (1 v) of [list v]

replace item (1 v) of [list v] with (nested list :: list)
Please indicate where this suggestion is.
WindOctahedron
Scratcher
1000+ posts

Nested lists

Monniasza_spzoo wrote:

What color these blocks should be?

I think about this:
Nested lists :: #ff0000
Nested Hashtables :: #ff0040
Hash-nested lists :: #ff4000
Multi-hashtables :: #ff8040
Treemaps :: #ff8080
That's a good idea! I also thought about colour distinguishing.
(Also, this is my 500th post!)

Last edited by WindOctahedron (Aug. 24, 2019 15:43:14)

Paddle2See
Scratch Team
1000+ posts

Nested lists

No, sorry - seems overly complicated for a first programming language. We don't want to confuse beginners. More advanced users know that it's not all that hard to implement multi-dimensional lists using single dimensional lists (such as Scratch already has) using an indexing function.

You might want to check out the Snap block-based programming language though. It is designed for more experienced programmers and has more complicated data structures than Scratch.

Powered by DjangoBB