Discuss Scratch
- Discussion Forums
- » Suggestions
- » Dictionaries AND Lists [A lot of supporters]
- super_crazy
-
100+ posts
Dictionaries AND Lists [A lot of supporters]
Dictionaries!!!
Scratch has varibles and lists but when I was learning python there were also Dictionaries.
Dictionaries work basically the same way as list except you can name the values inside of the dictionary. Eg:

This would look better ^ and I know it's spelt wrong :)
This can make storing Data for a game alot easier!
Some blocks could be:
Please comment about the idea
Also check out my other suggestion
Scratch has varibles and lists but when I was learning python there were also Dictionaries.
Dictionaries work basically the same way as list except you can name the values inside of the dictionary. Eg:

This would look better ^ and I know it's spelt wrong :)
This can make storing Data for a game alot easier!

Some blocks could be:
Dictionaires: :: greyThe Above is not the best but do you get what I mean?
add [(name)] with [(data)] to [dictionary v] :: list
Lists: :: grey
add [something] to [list v]
Please comment about the idea

Also check out my other suggestion
Last edited by Paddle2See (Sept. 16, 2023 00:02:00)
- Iditaroid
-
500+ posts
Dictionaries AND Lists [A lot of supporters]
I think adding a third kind of data like this would make things a bit more complicated for children just getting into programming, i mean, they'll have a hard enough time figuring out what a “variable” is supposed to be anyway!
- nwhi
-
100+ posts
Dictionaries AND Lists [A lot of supporters]
Yes, but the workarounds are either slow or can only handle a fixed amount of elements. Work-aroundable.
EDIT: Should probably include the workaround.

define get element (key)
set [i v] to [1]
set [r v] to [0]
set [error v] to [0]
repeat until <not <(r) = [0]>>
if <(i) > (length of [keys v])>
set [r v] to [-1]
set [error v] to [1]
else
if <(item (i) of [keys v]) = (key)>
set [r v] to (i)
end
end
change [i v] by (1)
end
if <(error) = [0]>
set [r v] to (item (r) of [items v])
end
Last edited by nwhi (Oct. 17, 2014 11:46:32)
- DemCupcakesYo
-
100+ posts
Dictionaries AND Lists [A lot of supporters]
Wait, so are they dictionaires or dictionaries?
Also, support.
Also, support.
- MegaApuTurkUltra
-
1000+ posts
Dictionaries AND Lists [A lot of supporters]
Support! Although it would be cool to make a hashtable implementation in scratch…
- TheHockeyist
-
1000+ posts
Dictionaries AND Lists [A lot of supporters]
dictionaires or dictionaries?Wait, so are they
Also, support.
The second. I'm indifferent. It would be nice, but I think it might be too confusing for newer Scratchers.
- theonlygusti
-
1000+ posts
Dictionaries AND Lists [A lot of supporters]
I think that we should just have lists within lists, so 2d, 3d, even 4d lists.
Then we could do:
Then we could do:
(item (1 v) of (item (2 v) of [list v]))
- Firedrake969
-
1000+ posts
Dictionaries AND Lists [A lot of supporters]
Pretty easily workaroundable with two lists/dict.
The workaround I use is neither slow nor limited
The workaround I use is neither slow nor limited

Last edited by Firedrake969 (Oct. 17, 2014 15:31:19)
- theonlygusti
-
1000+ posts
Dictionaries AND Lists [A lot of supporters]
Same. Pretty easily workaroundable with two lists/dict.
The workaround I use is neither slow nor limited
- super_crazy
-
100+ posts
Dictionaries AND Lists [A lot of supporters]
True but new programmers don't have to use them. I bet half the new proggrammers don't understand the “Define” block or “clones” but scratch still has them I think adding a third kind of data like this would make things a bit more complicated for children just getting into programming, i mean, they'll have a hard enough time figuring out what a “variable” is supposed to be anyway!


- Zro716
-
1000+ posts
Dictionaries AND Lists [A lot of supporters]
no support. I've made countless workarounds to this, one of which is easy to replicate:
define get metadata of element (element)
if <[Elements v] contains (element)> then
set [counter v] to [1]
repeat until <(item (counter) of [Elements v]) = (element)>
change [counter v] by (1)
end
set [metadata v] to (item (counter) of [Metadata v])
else
set [metadata v] to []
- Prinseskat
-
1000+ posts
Dictionaries AND Lists [A lot of supporters]
Support. There are workarounds, sure, but it would make it a lot easier.
- 20btheilmanngohr
-
100+ posts
Dictionaries AND Lists [A lot of supporters]
This might make things a lot more compact.
(+1)
(+1)
- ScratchCoolGuy
-
41 posts
Dictionaries AND Lists [A lot of supporters]
Dictionaries!!!I support! This is a great idea. I know there are workaraounds, but I like to see new blocks in Scratch. I will add this to a Scratch Extension I(@Syno) am making.
Scratch has varibles and lists but when I was learning python there were also Dictionaries.
Dictionaries work basically the same way as list except you can name the values inside of the dictionary. Eg:
This would look better ^ and I know it's spelt wrong :)
This can make storing Data for a game alot easier!
Some blocks could be:Dictionaires: :: grey cstartThe Above is not the best but do you get what I mean?
add [(name)] with [(data)] data to [dictionary v] :: list
Lists: :: celse
add [something] to [list v]
Please comment about the ideaSupporters [5 v] :: grey cstartAlso check out my other suggestion
Blueinkproductions :: operators
DemCupcakesYo :: operators
MegaApuTurkUltra :: operators
Prinseskat :: operators
20btheilmanngohr :: operators
super_crazy :: operators
PLEASE SUPPORT :) :: cend

- Cyoce
-
500+ posts
Dictionaries AND Lists [A lot of supporters]
Here's the problem I have with that system. If you call it again while the first one is running, the metadata variable will get messed up, and one of your scripts will use the wrong value. Also, no support. I've made countless workarounds to this, one of which is easy to replicate:define get metadata of element (element)
if <[Elements v] contains (element)> then
set [counter v] to [1]
repeat until <(item (counter) of [Elements v]) = (element)>
change [counter v] by (1)
end
set [metadata v] to (item (counter) of [Metadata v])
else
set [metadata v] to []
replace item [Cyoce] of [Supporters v] with [+1]
Last edited by Cyoce (Oct. 18, 2014 14:33:24)
- djdolphin
-
1000+ posts
Dictionaries AND Lists [A lot of supporters]
Support! I was planning on writing an extension for dictionaries today. Weird coincidence. 

- Discussion Forums
- » Suggestions
-
» Dictionaries AND Lists [A lot of supporters]