Discuss Scratch

SavetheAtlantic
Scratcher
1000+ posts

Add an Arrow Function and Operator.

Frenzyboyz33 wrote:

no, you put two variables into it, and merges their properties (I think)
What do you mean by “I think”? Do you not even know what your own suggestion does?

Last edited by SavetheAtlantic (Dec. 7, 2022 15:50:08)

cookieclickerer33
Scratcher
1000+ posts

Add an Arrow Function and Operator.

Frenzyboyz33 wrote:

7salad3salad wrote:

cookieclickerer33 wrote:

7salad3salad wrote:

hill_walker123 wrote:

what he means is you don't have to have a variable to hold data, it can look back to a previous part of the code to get a value.
edit: at least I think
finally an actual explanation
I still don’t get it
Is this just script variables?
like you dont need to create a whole new variable, if they have an arrow block you can put something in there to temporarily hold data (though i dont know the differences between the different arrows)
no, you put two variables into it, and merges their properties (I think)
You don’t even know what it does???
Then why are you suggesting it?
Frenzyboyz33
Scratcher
100+ posts

Add an Arrow Function and Operator.

cookieclickerer33 wrote:

Frenzyboyz33 wrote:

7salad3salad wrote:

cookieclickerer33 wrote:

7salad3salad wrote:

hill_walker123 wrote:

what he means is you don't have to have a variable to hold data, it can look back to a previous part of the code to get a value.
edit: at least I think
finally an actual explanation
I still don’t get it
Is this just script variables?
like you dont need to create a whole new variable, if they have an arrow block you can put something in there to temporarily hold data (though i dont know the differences between the different arrows)
no, you put two variables into it, and merges their properties (and stuff)
You don’t even know what it does???
Then why are you suggesting it?
it's the arrow function, I'm not clear about it, THATS IT.
I still want it for other users too, like @Griffpatch

Last edited by Frenzyboyz33 (Dec. 8, 2022 18:54:31)

Frenzyboyz33
Scratcher
100+ posts

Add an Arrow Function and Operator.

PkmnQ wrote:

These look nothing like arrow functions to me. What do they do, compared to normal actual JS arrow functions?
they work the same way. the output attached is for when you use it as a value, since it would useless otherwise
cookieclickerer33
Scratcher
1000+ posts

Add an Arrow Function and Operator.

Frenzyboyz33 wrote:

cookieclickerer33 wrote:

Frenzyboyz33 wrote:

7salad3salad wrote:

cookieclickerer33 wrote:

7salad3salad wrote:

hill_walker123 wrote:

what he means is you don't have to have a variable to hold data, it can look back to a previous part of the code to get a value.
edit: at least I think
finally an actual explanation
I still don’t get it
Is this just script variables?
like you dont need to create a whole new variable, if they have an arrow block you can put something in there to temporarily hold data (though i dont know the differences between the different arrows)
no, you put two variables into it, and merges their properties (and stuff)
You don’t even know what it does???
Then why are you suggesting it?
it's the arrow function, I'm not clear about it, THATS IT.
I still want it for other users too, like @Griffpatch
Then what’s the use for it
Frenzyboyz33
Scratcher
100+ posts

Add an Arrow Function and Operator.

alot of things, actually
qwerty_wasd_gone
Scratcher
1000+ posts

Add an Arrow Function and Operator.

when green flag clicked
set [my variable v] to [hello]
say (my variable)
Jonathan50
Scratcher
1000+ posts

Add an Arrow Function and Operator.

In this example of yours,

7salad3salad wrote:

it would presumably say “hello”. But it isn't really clear what “my variable” is doing there, or how it's different from

qwerty_wasd_gone wrote:

when green flag clicked
set [my variable v] to [hello]
say (my variable)
(since it seems to be more than just a local variable called “a”)


Judging by the fact that it's based on JavaScript's arrow function, maybe it's meant to define a local custom reporter block, like
when gf clicked
arrow (x) ⇨ ((x) * (x)) (square () :: operators) :: operators
say (square (3) :: operators) for (2) secs // 9
say (square (4) :: operators) for (2) secs // 16
which in Snap! would be
when gf clicked
script variables (square) @delInput @addInput :: grey
set [square v] to (((x) * (x)) input names: (x) @delInput @addInput :: grey ring)
say (call (square) with inputs [3] @delInput @addInput :: control) for (2) secs
say (call (square) with inputs [4] @delInput @addInput :: control) for (2) secs
so you might need to explain a bit more clearly if you have an idea what you want.
Creator-H
Scratcher
100+ posts

Add an Arrow Function and Operator.

Frenzyboyz33 wrote:

7salad3salad wrote:

cookieclickerer33 wrote:

7salad3salad wrote:

hill_walker123 wrote:

what he means is you don't have to have a variable to hold data, it can look back to a previous part of the code to get a value.
edit: at least I think
finally an actual explanation
I still don’t get it
Is this just script variables?
like you dont need to create a whole new variable, if they have an arrow block you can put something in there to temporarily hold data (though i dont know the differences between the different arrows)
no, you put two variables into it, and merges their properties (and stuff)
Wdym by merge? I thought I understood it, but…
ajskateboarder
Scratcher
1000+ posts

Add an Arrow Function and Operator.

bump
yavuz61035
Scratcher
500+ posts

Add an Arrow Function and Operator.

Frenzyboyz33 wrote:

maybe they could be merged into one block?
it should be merged into -> to avoid clutter

does having 2 blocks that do the same thing except looking different make sense
Frenzyboyz33
Scratcher
100+ posts

Add an Arrow Function and Operator.

Jonathan50 wrote:

In this example of yours,

7salad3salad wrote:

it would presumably say “hello”. But it isn't really clear what “my variable” is doing there, or how it's different from

qwerty_wasd_gone wrote:

when green flag clicked
set [my variable v] to [hello]
say (my variable)
(since it seems to be more than just a local variable called “a”)


Judging by the fact that it's based on JavaScript's arrow function, maybe it's meant to define a local custom reporter block, like
when gf clicked
arrow (x) ⇨ ((x) * (x)) (square () :: operators) :: operators
say (square (3) :: operators) for (2) secs // 9
say (square (4) :: operators) for (2) secs // 16
which in Snap! would be
when gf clicked
script variables (square) @delInput @addInput :: grey
set [square v] to (((x) * (x)) input names: (x) @delInput @addInput :: grey ring)
say (call (square) with inputs [3] @delInput @addInput :: control) for (2) secs
say (call (square) with inputs [4] @delInput @addInput :: control) for (2) secs
so you might need to explain a bit more clearly if you have an idea what you want.
exactly!
CST1229
Scratcher
1000+ posts

Add an Arrow Function and Operator.

Frenzyboyz33 wrote:

(#7)
when green flag clicked
Arrow (... :: functions) <...> ➜ <arrowValue :: operators> :: operators
say<arrowValue :: operators>

simplified version
So basically a “reusable function” block, something like the below?
when flag clicked
reporter ((1) + (timer)) as (block :: operators) :: operators
say (block :: operators) // 1
wait (1) seconds :: control
say (block :: operators) // ~2

Last edited by CST1229 (Dec. 12, 2022 13:44:56)

Frenzyboyz33
Scratcher
100+ posts

Add an Arrow Function and Operator.

basically a custom reporter
7salad3salad
Scratcher
1000+ posts

Add an Arrow Function and Operator.

Frenzyboyz33 wrote:

basically a custom reporter
which is what a variable is??
bbrainstormer
Scratcher
11 posts

Add an Arrow Function and Operator.

Frenzyboyz33 wrote:

cookieclickerer33 wrote:

Frenzyboyz33 wrote:

there also isn't a workaround, and this would be very useful
What does it do still, I don’t Understand
look here then.
https://www.w3schools.com/js/js_arrow_function.asp

Interesting idea, but could be worded much better. I shouldn't have to read through the comments to understand your idea.

Last edited by bbrainstormer (Dec. 12, 2022 17:44:18)

Frenzyboyz33
Scratcher
100+ posts

Add an Arrow Function and Operator.

sorry
banana439monkey
Scratcher
1000+ posts

Add an Arrow Function and Operator.

with all due respect
i actually want to gouge my eyes out
arrows are not it lol
also why is “my variable” necessary in this context?
that said i'd be happy for something similar to:
let a = arrow("hello")
say(a)
set [a v] to (arrow [hello] :: custom)
say (a)

which would be way better than
arrow("hello").then(a => {
   say(a)
});
arrow [hello] then with returned value as (a :: custom)  {
say (a :: custom)
} :: custom

but even if i want to gouge my eyes out, i understand that scratch's primary demographic will not understand the async/await style of js, so i guess i might well be willing to accept having both blocks available to me

Banana
7salad3salad
Scratcher
1000+ posts

Add an Arrow Function and Operator.

Frenzyboyz33 wrote:

sorry
Why “sorry”?
Little_Mittle12345
Scratcher
100+ posts

Add an Arrow Function and Operator.

BUmp!

Powered by DjangoBB