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.

Generation 2: the first time you see this copy and paste it on top of your sig in the scratch forums and increase generation by 1. Social experiment.
____                  _____  _______              
| \ | | | | | |\ | | /
|___/ | | | |__ | | \ | |/
| \ | | | | | | \ | |\
| | | | | | | | \ | | \
|___/ L____ \___/ |_____ ___|___ | \| | \
PRODUCTIONS





















































Here's a hint: support = support.

<shameless self promotion>follow me! follow me! follow me! love my stuff! love my stuff! love my stuff! follow me! love my stuff! remix my stuff! follow me! follow me! </shameless self promotion>
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)


//// the word “pet peeve” fundamentally irks me ////
DemCupcakesYo
Scratcher
100+ posts

Dictionaries AND Lists [A lot of supporters]

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

-DemCupcakesYo

If you support, it should be +1. If you don't, it should be +0, not -1. If you half-support, it should be +1/2 or +0.5, not +0. You can't subtract from the supporters.

My browser / operating system: Windows 7, Chrome 36.0.1985.125, Flash 14.0 (release 0)

MegaApuTurkUltra
Scratcher
1000+ posts

Dictionaries AND Lists [A lot of supporters]

Support! Although it would be cool to make a hashtable implementation in scratch…

$(".box-head")[0].textContent = "committing AT crimes since $whenever"
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)


'17 rickoid

bf97b44a7fbd33db070f6ade2b7dc549
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 []

As a long time Scratcher, I have found new meaning to the name “Scratch”: for me, it means to “scratch that itch”, to come back again and again to realize new ideas in this toy language, even when I'm capable of creating my projects in real programming languages years later. It's a friend that helped me to pursue programming and get me to enjoy its fruit. I'm certain many others who have walked this path as well have grown fond of its importance in their life.
Prinseskat
Scratcher
1000+ posts

Dictionaries AND Lists [A lot of supporters]

Support. There are workarounds, sure, but it would make it a lot easier.

haha funny kumquat meme
20btheilmanngohr
Scratcher
100+ posts

Dictionaries AND Lists [A lot of supporters]

This might make things a lot more compact.
(+1)

You can visit my profile here.
 
when green flag clicked ::category operators
display [link v] [http://scratch.mit.edu/users/20btheilmanngohr/] ::extension
display [text v] [20btheilmanngohr] ::extension
display [text v] [always striving for excellence!] ::extension

DerAxeEffekt
Scratcher
100+ posts

Dictionaries AND Lists [A lot of supporters]

Support!

(insert oversized quotation mark) If it is on the internet, it must be true. (insert another oversized quotation mark)
-Abraham Lincoln
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.

ScratchNet – Wiki
Amplifying Scratch
NolanAwesome
Scratcher
500+ posts

Dictionaries AND Lists [A lot of supporters]

Support

ey em bord.
Scratchers to check out:
- DravenN
- SUPERMAR
- -Sunset-
- whadada
NOLAN | NO, ACTIVE, FOLLOWERS
(no really, no views on my projects)
Give me an internet
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