Discuss Scratch

super_crazy
Scratcher
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:
Dictionaires: :: grey
add [(name)] with [(data)] to [dictionary v] :: list
Lists: :: grey
add [something] to [list v]
The Above is not the best but do you get what I mean?
Please comment about the idea

Also check out my other suggestion

Last edited by Paddle2See (Sept. 16, 2023 00:02:00)

Blueinkproductions
Scratcher
1000+ posts

Dictionaries AND Lists [A lot of supporters]

Support.
Blaze349
Scratcher
1000+ posts

Dictionaries AND Lists [A lot of supporters]

Work-aroundable.
Iditaroid
Scratcher
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
Scratcher
100+ posts

Dictionaries AND Lists [A lot of supporters]

Blaze349 wrote:

Work-aroundable.
Yes, but the workarounds are either slow or can only handle a fixed amount of elements.

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
Scratcher
100+ posts

Dictionaries AND Lists [A lot of supporters]

Wait, so are they dictionaires or dictionaries?
Also, support.
MegaApuTurkUltra
Scratcher
1000+ posts

Dictionaries AND Lists [A lot of supporters]

Support! Although it would be cool to make a hashtable implementation in scratch…
TheHockeyist
Scratcher
1000+ posts

Dictionaries AND Lists [A lot of supporters]

DemCupcakesYo wrote:

Wait, so are they dictionaires or dictionaries?
Also, support.

The second. I'm indifferent. It would be nice, but I think it might be too confusing for newer Scratchers.
theonlygusti
Scratcher
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:
(item (1 v) of (item (2 v) of [list v]))
Firedrake969
Scratcher
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

Last edited by Firedrake969 (Oct. 17, 2014 15:31:19)

theonlygusti
Scratcher
1000+ posts

Dictionaries AND Lists [A lot of supporters]

Firedrake969 wrote:

Pretty easily workaroundable with two lists/dict.
The workaround I use is neither slow nor limited
Same.
super_crazy
Scratcher
100+ posts

Dictionaries AND Lists [A lot of supporters]

Iditaroid wrote:

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!
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 . Scratch is aimed at all ages of all skill levels and so new Scratchers don't need to understand Dictionaries or use them until they are a bit more experienced.
Zro716
Scratcher
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
Scratcher
1000+ posts

Dictionaries AND Lists [A lot of supporters]

Support. There are workarounds, sure, but it would make it a lot easier.
20btheilmanngohr
Scratcher
100+ posts

Dictionaries AND Lists [A lot of supporters]

This might make things a lot more compact.
(+1)
DerAxeEffekt
Scratcher
100+ posts

Dictionaries AND Lists [A lot of supporters]

Support!
ScratchCoolGuy
Scratcher
41 posts

Dictionaries AND Lists [A lot of supporters]

super_crazy wrote:

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:
Dictionaires: :: grey cstart
add [(name)] with [(data)] data to [dictionary v] :: list
Lists: :: celse
add [something] to [list v]
The Above is not the best but do you get what I mean?
Please comment about the idea
Supporters [5 v] :: grey cstart
Blueinkproductions :: operators
DemCupcakesYo :: operators
MegaApuTurkUltra :: operators
Prinseskat :: operators
20btheilmanngohr :: operators
super_crazy :: operators
PLEASE SUPPORT :) :: cend
Also check out my other suggestion
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.
NolanAwesome
Scratcher
500+ posts

Dictionaries AND Lists [A lot of supporters]

Support
Cyoce
Scratcher
500+ posts

Dictionaries AND Lists [A lot of supporters]

Zro716 wrote:

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 []
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,
replace item [Cyoce] of [Supporters v] with [+1]

Last edited by Cyoce (Oct. 18, 2014 14:33:24)

djdolphin
Scratcher
1000+ posts

Dictionaries AND Lists [A lot of supporters]

Support! I was planning on writing an extension for dictionaries today. Weird coincidence.

Powered by DjangoBB