Discuss Scratch
- Discussion Forums
- » Suggestions
- » Nested lists
- 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?
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 [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
Both methods should be implemented. 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
What color these blocks should be?
I think about this:
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
Please indicate where this suggestion is. 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)
- WindOctahedron
- Scratcher
1000+ posts
Nested lists
That's a good idea! I also thought about colour distinguishing. 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
(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.
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.
- Discussion Forums
- » Suggestions
- » Nested lists