Discuss Scratch
- CGRises
-
500+ posts
Block Idea: Place of [word] in [list]
([First v] occurrence of [item] in [list v]::list)In all cases above, the “place” variable, is the answer.
set [place v] to [0]
set [counter v] to [1]
repeat until <<not <(place) = [0]>> or <(counter) = (length of [list v])>>
if <(item (counter) of [list v]) = (item)> then
set [place v] to (counter)
end
change [counter v] by (1)
end
([last v] occurrence of [item] in [list v]::list)
set [place v] to [0]
set [counter v] to [1]
repeat until <(counter) = (length of [list v])>
if <(item (counter) of [list v]) = (item)> then
set [place v] to (counter)
end
change [counter v] by (1)
end
([average v] occurrence of [item] in [list v]::list)
delete (all v) of [list of places v]
set [place v] to [0]
set [counter v] to [1]
repeat until <(counter) = (length of [list v])>
if <(item (counter) of [list v]) = (item)> then
add [place v] to [list of places v]
end
change [counter v] by (1)
end
set [counter v] to [1]
set [sum v] to [0]
repeat (length of [list of places v])
set [sum v] to ((item (counter) of [list of places v]) + (sum))
change [counter v] by (1)
end
set [place v] to ((sum) / (length of [list of places v]))
((number) occurrence of [item] in [list v]::list)
delete (all v) of [list of places v]
set [place v] to [0]
set [counter v] to [1]
repeat until <(counter) = (length of [list v])>
if <(item (counter) of [list v]) = (item)> then
add (counter) to [list of places v]
end
change [counter v] by (1)
end
set [place v] to (item (number) of [list of places v])
No support.
Last edited by CGRises (July 27, 2015 14:06:29)
- monstermash3
-
1000+ posts
Block Idea: Place of [word] in [list]
It's not a very easy workaround though....In all cases above, the “place” variable, is the answer.
No support.
- CGRises
-
500+ posts
Block Idea: Place of [word] in [list]
I think it is. Anyways, you wanted a delete all occurrences?It's not a very easy workaround though....In all cases above, the “place” variable, is the answer.
No support.
Delete all occurrences of [thing] in [list v]::list
delete (all v) of [occurrences v]
set [counter v] to [1]
repeat (length of [list v])
if <(item (counter) of [list v]) = [thing]> then
add (counter) to [occurrences v]
end
change [counter v] by (1)
end
set [counter v] to (length of [occurrences v])
repeat (length of [occurrences v])
delete (item (item (counter) of [occurrences v]) of [list v]) of [list v]
change [counter v] by (-1)
end
Last edited by CGRises (July 27, 2015 00:38:40)
- iamunknown2
-
1000+ posts
Block Idea: Place of [word] in [list]
Give me a text-based programming language that doesn't have an array-index system which starts at 0.You meant bad languages.add [thing] to [list v]now what
add [thing] to [list v]
add [thing] to [list v]
add [thing] to [list v]
set [index v] to (place of [thing] in [list v] ::list)
1.
Or zero if you do python/other languages that I don't know about
- monstermash3
-
1000+ posts
Block Idea: Place of [word] in [list]
Couldn't you just do this?I think it is. Anyways, you wanted a delete all occurrences?It's not a very easy workaround though....In all cases above, the “place” variable, is the answer.
No support.Delete all occurrences of [thing] in [list v]::list
...
set [item v] to [1]Still, it's not too easy.
repeat (length of [list v])
if <(item (item) of [list v]) = [thing]> then
delete (item) of [list v]
end
change [item v] by [1]
end
- iamunknown2
-
1000+ posts
Block Idea: Place of [word] in [list]
You can't. The list of items would shift whenever you deleted an item.Couldn't you just do this?I think it is. Anyways, you wanted a delete all occurrences?It's not a very easy workaround though....In all cases above, the “place” variable, is the answer.
No support.Delete all occurrences of [thing] in [list v]::list
...set [item v] to [1]Still, it's not too easy.
repeat (length of [list v])
if <(item (item) of [list v]) = [thing]> then
delete (item) of [list v]
end
change [item v] by [1]
end
Plus, the workaround isn't difficult, and I would doubt that New Scratchers would even use lists.
- Cream_E_Cookie
-
1000+ posts
Block Idea: Place of [word] in [list]
Support for((1st v) occurence of [thing] in [list v] ::list)
((last v) occurence of [thing] in [list v] ::list)
- bobbybee
-
1000+ posts
Block Idea: Place of [word] in [list]
Support, because this is a very logical, stanndard part of lists 

- CGRises
-
500+ posts
Block Idea: Place of [word] in [list]
thank you.You can't. The list of items would shift whenever you deleted an item.Couldn't you just do this?I think it is. Anyways, you wanted a delete all occurrences?It's not a very easy workaround though....In all cases above, the “place” variable, is the answer.
No support.Delete all occurrences of [thing] in [list v]::list
...set [item v] to [1]Still, it's not too easy.
repeat (length of [list v])
if <(item (item) of [list v]) = [thing]> then
delete (item) of [list v]
end
change [item v] by [1]
end
Plus, the workaround isn't difficult, and I would doubt that New Scratchers would even use lists.
- Deerleg
-
1000+ posts
Block Idea: Place of [word] in [list]
SUPPORT!
As to the workaround, I really do not want to have such a long block of code just to do that.
As to the workaround, I really do not want to have such a long block of code just to do that.
- IronBit_Studios
-
1000+ posts
Block Idea: Place of [word] in [list]
Support to ChocolatePi.
As to the workaround, I really do not want to have such a long block of code just to do that.
- TheGuyWithTheHat2
-
33 posts
Block Idea: Place of [word] in [list]
The workaround would also seriously slow down things for complicated scripts I think
Last edited by TheGuyWithTheHat2 (July 27, 2015 15:18:42)
- monstermash3
-
1000+ posts
Block Idea: Place of [word] in [list]
Oh, right. Fixed workaround: You can't. The list of items would shift whenever you deleted an item.
set [item v] to [1]But I still support. See the above post.
repeat until <(item) > ((length of [list v]) - (1))>
if <(item (item) of [list v]) = [thing]> then
delete (item) of [list v]
else
change [item v] by (1)
end
end
- CGRises
-
500+ posts
Block Idea: Place of [word] in [list]
Okay guys, look.
Not everything on scratch is easy. You are asking for a tailor made block when you can do the patchwork of the workaround yourself.
I don't think the workaround is hard for intermediate and above. New Scratchers wouldn't use it anyways. Scratch is made with a low floor, and a high ceiling. Because of the workaround, this block will only raise the floor.
There are no uses for the block I can think of of the top of my head, (except the delete all occurrences).
Scratch is made with a low floor, and a high ceiling. Because of the workaround, this block will only raise the floor.
I've already stated it before: No support.
Not everything on scratch is easy. You are asking for a tailor made block when you can do the patchwork of the workaround yourself.
I don't think the workaround is hard for intermediate and above. New Scratchers wouldn't use it anyways. Scratch is made with a low floor, and a high ceiling. Because of the workaround, this block will only raise the floor.
There are no uses for the block I can think of of the top of my head, (except the delete all occurrences).
Scratch is made with a low floor, and a high ceiling. Because of the workaround, this block will only raise the floor.
I've already stated it before: No support.
Last edited by CGRises (July 28, 2015 13:51:33)
- Cream_E_Cookie
-
1000+ posts
Block Idea: Place of [word] in [list]
Um, these blocks have just the same difficulty level workarounds: Okay guys, look.
Not everything on scratch is easy. You are asking for a tailor made block when you can do the patchwork of the workaround yourself.
I don't think the workaround is hard for intermediate and above. New Scratchers wouldn't use it anyways. Scratch is made with a low floor, and a high ceiling. Because of the workaround, this block will only raise the floor.
There are no uses for the block I can think of of the top of my head, (except the delete all occurrences).
Scratch is made with a low floor, and a high ceiling. Because of the workaround, this block will only raise the floor.
I've already stated it before: No support.
move () steps
go to [ v]
- CGRises
-
500+ posts
Block Idea: Place of [word] in [list]
A:Um, these blocks have just the same difficulty level workarounds: Okay guys, look.
Not everything on scratch is easy. You are asking for a tailor made block when you can do the patchwork of the workaround yourself.
I don't think the workaround is hard for intermediate and above. New Scratchers wouldn't use it anyways. Scratch is made with a low floor, and a high ceiling. Because of the workaround, this block will only raise the floor.
There are no uses for the block I can think of of the top of my head, (except the delete all occurrences).
Scratch is made with a low floor, and a high ceiling. Because of the workaround, this block will only raise the floor.
I've already stated it before: No support.move () steps
go to [ v]
move () stepsis impossible very hard to workaround.
You mean these:
change x by ()B: It is made that way so it has a lower floor, while retaining the high ceiling. Scratch is designed to let people new to programming have a good place to start, and still making it possible for great things to be made. I was saying that the block suggested wouldn't be used by newer Scratchers, and still has the workaround. You are talking about is a block used in a ton of projects, and is used by newer Scratchers. In both cases the workaround is for intermediates, but the change X/Y blocks are for everyone.
change y by ()
Last edited by CGRises (July 29, 2015 00:54:26)
- TheGuyWithTheHat2
-
33 posts
Block Idea: Place of [word] in [list]
I was thinking that this would make this easier when making some kind of Cleverbot project, so the AI could say things in response to things people have said before, that would transfer to a cloud list (not sure if they exist yet, might have to check, probably not) and the response list would correspond with the people saying things list.