Discuss Scratch

gamer270
Scratcher
18 posts

split block

I want a block like this to be added like
(split (scratch) at character(character to split at))
you could put it inside a list item select block like this
(item (1 v) of (split (scratch) at character(character to split at))) 
If
(character to split at)
was “a” the two items in the list would be “scr” and “tch”
AonymousGuy
Scratcher
1000+ posts

split block

gamer270 wrote:

I want a block like this to be added like
(split [scratch] at character [a]) //category=operators
That block looks better.

Anyways, I think this could be interesting, but would have to handle lists differently (as they are handled in BYOB) so I think that there needs to be a different way to make this block if it is going to be implemented.
1234abcdcba4321
Scratcher
1000+ posts

split block

no support, already workaroundable.

I'd highly appreciate it if you were to follow me. Don't forget to go to my profile.
All of my programming suggestions <— You should really get the suggestions move back to the suggestions forum!
Five hundred posts! I never expected to get up there… In only 2-3 months.
Does anyone know what a signature is? I mean, I've already seen 6-7 people get confused.
rollercoasterfan
Scratcher
1000+ posts

split block

Support!














when [chromometer altimeter v] = [5th length v] and [7th length v] with a [gap v] of (17) ::events hat
forge [chromometer v] altimeter until < (speed) = (velocity)> ::control cstart
switch places with (759 v) altimeters with value of (speed) ::looks
control [altimeter 1 v] at time (10):(17):(58) ::control
end
initialize sequence (24) so [object 3 v] moves to x (156) y (231) ::control
reveal [final answer v] and stop running this script ::events cap
sithsiri
Scratcher
100+ posts

split block

support

Click here for an addition to procd's .sb2 to .exe compiler! It makes the compiler easier to use.
Copy some various emojis and chars from here. It'll come in handy for comments and things: ☁∞πℼ℉℃©®℗™℠§
Find more symbols at www.fsymbols.com
Told you kumquats are nice! That one over there gave me my signature!

9+10=19
Imagine+Program+Share=7+7+5
7+7+5=19
Scratch just makes sense.

Fake link! I used 00a1ff
Cream_E_Cookie
Scratcher
1000+ posts

split block

Support, but make it better

















Zekrom01
Scratcher
1000+ posts

split block

support

ɴᴏᴡ ᴘʟᴀʏɪɴɢ: Despacito 2 (Feat: Lil Pump) ───────────⚪────── ◄◄⠀▐▐ ⠀►►⠀⠀ ⠀
DaSpudLord
Scratcher
1000+ posts

split block

No support, workaroundable.

Also, there's a duplicate out there somewhere.

Last edited by DaSpudLord (Aug. 31, 2015 16:26:48)



U^ェ^U::motion//This is Blocky. He lives in my signature. He is a trained attack block. He protects my siggy from kumquats.
Cream_E_Cookie
Scratcher
1000+ posts

split block

DaSpudLord wrote:

No support, workaroundable.

Also, there's a duplicate out there somewhere.
Actually, the thread that you are probably thinking of is the duplicate.

DaSpudLord wrote:

No support, workaroundable.

Also, there's a duplicate out there somewhere.
Anything is workaroundable.
(well, you g et my point)

















DaSpudLord
Scratcher
1000+ posts

split block

Cream_E_Cookie wrote:

DaSpudLord wrote:

No support, workaroundable.

Also, there's a duplicate out there somewhere.
Anything is workaroundable.
(well, you g et my point)
Is this workaroundable?
create file [] at []::custom
Because if so, I'd love to hear the workaround. (Seriously, I would really like this.)

Last edited by DaSpudLord (Aug. 31, 2015 17:24:58)



U^ェ^U::motion//This is Blocky. He lives in my signature. He is a trained attack block. He protects my siggy from kumquats.
Zro716
Scratcher
1000+ posts

split block

The thing is the interpreter was not built to report lists as themselves, they get cast to strings. I would totally love a built-in split function to complement the join block (really bugging me a lot) and speed up many of my operations and save myself a few variables and debugging headaches… Though, I prefer that the split function, due to the nature of the interpreter, be a list stack block

split [hello, world!] by [space v] into [list v] ::list // where [space v] includes all characters on a standard keyboard
split [hello, world!] by [each letter v] into [list v] ::list // and includes this option too
If need be, the delimiter input can take anything so that more complicated splittings may be used.

Last edited by Zro716 (Aug. 31, 2015 17:27:51)


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.
DaSpudLord
Scratcher
1000+ posts

split block

Zro716 wrote:

The thing is the interpreter was not built to report lists as themselves, they get cast to strings. I would totally love a built-in split function to complement the join block (really bugging me a lot) and speed up many of my operations and save myself a few variables and debugging headaches… Though, I prefer that the split function, due to the nature of the interpreter, be a list stack block

split [hello, world!] by [space v] into [list v] ::list // where [space v] includes all characters on a standard keyboard
split [hello, world!] by [each letter v] into [list v] ::list // and includes this option too
If need be, the delimiter input can take anything so that more complicated splittings may be used.
Actually, if removed, the
(join [][])
block would not have a workaround. Sure, you could use a list with the
(list::list)
reporter, but then there would be a space between each joined string, so… not a real workaround. But a split block does have a workaround.

Last edited by DaSpudLord (Aug. 31, 2015 17:34:32)



U^ェ^U::motion//This is Blocky. He lives in my signature. He is a trained attack block. He protects my siggy from kumquats.
Zro716
Scratcher
1000+ posts

split block

DaSpudLord wrote:

Actually, if removed, the
(join [][])
block would not have a workaround. Sure, you could use a list with the
(list::list)
reporter, but then there would be a space between each joined string, so… not a real workaround. But a split block does have a workaround.
you don't have enough experience to appreciate the benefit of the split function. Especially in scratch where it is required to hack the JSON to fully utilize a custom script for splitting a string into a list. And hacking =/= valid workaround.
split [hello world] by [ ] into [list v]
/* have to hack the custom block procDef and call blocks to be able ::grey
to specify an available list without having to type it in every time */ ::grey
define split (string) by (splitter) into (list)
delete (all v) of (list) // have to hack the list blocks
set [split_substr v] to []
set [split_i v] to [0]
if <(splitter) = []> then // empty splitter means split by each letter
repeat (length of (string))
change [split_i v] by (1)
add (letter (split_i) of (string)) to (list)
end
else
repeat (length of (string))
change [split_i v] by (1)
set [split_chr v] to (letter (split_i) of (string))
if <(split_chr) = (splitter)> then
add (split_substr) to (list)
set [split_substr v] to []
else
set [split_substr v] to (join (split_substr)(split_chr))
end
end
if <not <(split_substr) = []>> then // leave no substring unadded
add (split_substr) to (list)
end
end

Last edited by Zro716 (Aug. 31, 2015 18:10:32)


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.
Cream_E_Cookie
Scratcher
1000+ posts

split block

DaSpudLord wrote:

Cream_E_Cookie wrote:

DaSpudLord wrote:

No support, workaroundable.

Also, there's a duplicate out there somewhere.
Anything is workaroundable.
(well, you g et my point)
Is this workaroundable?
create file [] at []::custom
Because if so, I'd love to hear the workaround. (Seriously, I would really like this.)
I mean what exist's in scratch.

















DaSpudLord
Scratcher
1000+ posts

split block

Cream_E_Cookie wrote:

DaSpudLord wrote:

...
I mean what exist's in scratch.
So this is workaroundable?
turn video [on v]

Zro716 wrote:

you don't have enough experience to appreciate the benefit of the split function.
No, but I have enough wisdom to understand the benefit of not having the split function-
  1. It could be confusing to inexperienced scratchers. Considering Scratch revolves around new scratchers, this is a stronger reason than some might realize.
  2. Forcing inexpereinced scratchers to come up with the workaround allows for a learning experience. It offers a chance to put their skills to the test in a problem-solving application. If they fail, then they can look up the answer and figure out how it works, so that next time they might succeed. Scratch revolves around teaching scratchers how to program and, more importantly, how to make stuff for themselves instead of being handed workarounds.
  3. Again, this is also a learning experience for skilled Scratchers. Without the block, you guys are forced to create the workaround. Whenever the workaround doesn't work they way you need it to for your project, that's another learning experience as you guys must test your brains to make the workaround work for you instead of having a workaround that doesn't work.
  4. Tired of programming being too simple? Then leave. Scratch is not about the skilled scratchers. It is not about you and me. It is for the unskilled scratchers to learn. Our purpose on this site is to create projects to act as guides that teach others how to do stuff that they might not know how to do. Stop trying to take Scratch and make it for you and the other skilled Scratchers. Instead, start thinking about the little guys for once.


U^ェ^U::motion//This is Blocky. He lives in my signature. He is a trained attack block. He protects my siggy from kumquats.
Znapi
Scratcher
500+ posts

split block

Zro716 wrote:

DaSpudLord wrote:

…a split block does have a workaround.
split [hello world] by [ ] into [list v]
/* have to hack the custom block procDef and call blocks to be able ::grey
to specify an available list without having to type it in every time */ ::grey
define split (string) by (splitter) into (list)
delete (all v) of (list) // have to hack the list blocks
set [split_substr v] to []
set [split_i v] to [0]
if <(splitter) = []> then // empty splitter means split by each letter
repeat (length of (string))
change [split_i v] by (1)
add (letter (split_i) of (string)) to (list)
end
else
repeat (length of (string))
change [split_i v] by (1)
set [split_chr v] to (letter (split_i) of (string))
if <(split_chr) = (splitter)> then
add (split_substr) to (list)
set [split_substr v] to []
else
set [split_substr v] to (join (split_substr)(split_chr))
end
end
if <not <(split_substr) = []>> then // leave no substring unadded
add (split_substr) to (list)
end
end
This is why I support a split block. Look at that work around. I'm not worried about the complexity of the workaround, but rather the speed it runs at. Given enough free time, I could come up with a custom block to do it, but it would run too slowly for my needs.

EDIT: Although it isn't very important and shouldn't matter, but to add to your own knowledge, the join block can be worked around using lists. If each item of the list is one character, there won't be spaces in between when joined. So, you just take the two strings to join, add each character one by one of both to a list, and use the list reporter.

Last edited by Znapi (Aug. 31, 2015 22:14:25)

scrooge200
Scratcher
1000+ posts

split block

Support.

Last edited by scrooge200 (Aug. 31, 2015 23:04:35)


“This 10 by 10 room
is exactly the right size:
gelatinous cube.”
- Kingdom of Loathing










https://scratch.mit.edu/discuss/topic/38849/?page=1
Cream_E_Cookie
Scratcher
1000+ posts

split block

@DaSpudLord I mean most blocks.

















CatsUnited
Scratcher
1000+ posts

split block

Support for a split block to increase the speed of it.

I AM SELLING CRAM | smug hat kid dance | fetch | Sans Gaming
Galar Dex - 120/400 (30%)
DaSpudLord
Scratcher
1000+ posts

split block

Also, one more thing- (and yes, while this is not a definite reason to no support a suggestion, this is something I want to point out.)

I see 100 suggestions daily- all kinds of stuff. Almost none of them get accepted. What makes you think this one is special? I'm just saying I highly doubt this will get implemented.


U^ェ^U::motion//This is Blocky. He lives in my signature. He is a trained attack block. He protects my siggy from kumquats.

Powered by DjangoBB

Standard | Mobile