Discuss Scratch

Monniasza_spzoo
Scratcher
100+ posts

Nested hashtables

Hybrid of hashtables and nested lists, they are advanced storage method, storing hastables, each with its name.

Blocks used (exclude red blocks):
Manipulation of individual items of sub-hashtables {
delete [] from sub-hashtable [] of nested hashtable[list v] :: list
set [] of sub-hashtable [] in nested hashtable [list v] to [thing] :: list
}

Reading of sublists{
reporter (get [] of sub-hashtable [] of nested hashtable [list v] :: list)
reporter (length of sub-hashtable [] in nested hashtable [list v] :: list)
predicate <sub-hashtable [] of nested hashtable [ v] contains key [thing] ? :: list>
predicate <sub-hashtable [] of nested hashtable [ v] contains value [thing] ? :: list>
}

Reading of whole nested list {
predicate <any sub-hashtable of nested hashtable[ v] contains key [thing] ? :: list>
predicate <any sub-hashtable of nested hashtable[ v] contains value [thing] ? :: list>
reporter (sub-hashtable count of nested hashtable [list v] :: list)
}

Manipulation of whole sublists {
set sub-hashtable [] of nested hashtable [list v] to hashtable [ v] :: list
delete sub-hashtable [] of nested hashtable [list v] :: list
}

Reading whole sublists{
set hashtable [ v] to sub-hashtable [] of nested hashtable [list v] :: list
}

Last edited by Monniasza_spzoo (Aug. 22, 2019 09:10:09)

WindOctahedron
Scratcher
500+ posts

Nested hashtables

I'm sorry, but your suggestion has been rejected:

Za-Chary wrote:

1.7 2D lists
2D lists, also known as 2D arrays, nested lists, or matrices, are a type of data structure that allows you to put an entire list as an element of another list; that is, it allows you to put lists inside of lists. These sorts of data structures are used widely in other programming languages.

The block below, and others, would allow you to create 2D lists to store information, sort of like a table. However, this is too complicated for what is supposed to be an introductory programming language. In addition, there are workarounds possible by using an ordinary list and an indexing function.

For those who are interested, it may be worth checking out Snap. It is a block-based programming language designed for more experienced programmers, and has more advanced data structures than Scratch does.

add () to sublist () of [list v] :: list

The studio of my best projects!
Tera RP
Common misconceptions about Scratch
_________________________

toki! mi nimi li WinOkawiton. taso sina ken toki tawa mi: jan Win o!
Hello! My name is WindOctahedron (a.k.a. WinOkawiton). But you can tell to me: person Wind (a.k.a. Win) call!!
Hello! My name is WindOctahedron, but you can call me “Wind”!

Powered by DjangoBB

Standard | Mobile