Discuss Scratch

Monniasza_spzoo
Scratcher
100+ posts

Nested lists

Treemaps, hashtables and hash-nested lists have their threads and are closely related.
UnconstructivePoster
New to Scratch
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)

Nestlé is an evil company. Don't buy their products!









Bookmarking some posts:
- explanation of cloud variable string encoding
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)


The message above may contain wrong information, rude remarks, or something embarrassing to my current self. In this case, please ignore it and remember that I likely wrote it back when I didn't know what “respect” truly meant. I really hate thinking about it again.
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.

Scratch Team Member, kayak and pickleball enthusiast, cat caregiver.

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.
(credit to Za-Chary)



;

Powered by DjangoBB