Discuss Scratch

bharvey
Scratcher
1000+ posts

Snap! user discussion

Scratch_Mapping wrote:

How do you create your own block libraries?
From the file menu, select “Export blocks”; this will give you a dialog window in which you can select which blocks to include. (Hint: If the blocks you care about use other custom blocks, you have to include those too!) If you right-click in that window you can check or uncheck all the blocks at once.

Depending on your browser, this will either directly save an .xml file in your download folder or open a browser tab which you can then save as an .xml file.

To load the library file into a project, just drag it in, or choose File>Import.

Last edited by bharvey (Feb. 15, 2017 02:11:34)


Scratch_Mapping
Scratcher
100+ posts

Snap! user discussion

I am trying to make these in Snap!:
[break out v] of loop::control cap
[continue with next iteration v] of loop::control cap

 :: obsolete
:: #FFFFFF
:: pen
bharvey
Scratcher
1000+ posts

Snap! user discussion

Scratch_Mapping wrote:

[break out v] of loop::control cap
[continue with next iteration v] of loop::control cap
In the Tools library are blocks CATCH and THROW.

You can make custom looping blocks that include the two CATCHes, and define custom BREAK and CONTINUE blocks with the two THROWs. Nested loops should work properly too, although if you use the same catchtags then of course you can't break out of multiple levels at once.

Last edited by bharvey (Feb. 16, 2017 04:14:37)


MichaelOlifant
Scratcher
30 posts

Snap! user discussion

Where's the generator project?

The CAPITALBOYS will protect me from kumquats.
~smile~ Y combinator:
define Y(fn)
report ((call (fn) with inputs (fn) [] @delInput @addInput::control)@addInput::grey ring)::control cap

say(call(Y((if <(num) = [0]> then [1] else ((num) x (call (fact) with inputs (fact) ((num)-(1))@delInput @addInput::control)::operators)::control) input names: ((fact)::grey) ((num)::grey) @delInput @addInput :: grey ring)) with inputs [5] @delInput @addInput::control
MichaelOlifant
Scratcher
30 posts

Snap! user discussion

bharvey wrote:

Chibi-Matoran wrote:

However, the report block is a stack block, and the call block's ring can only accept reporter statements. Aside from making a named custom reporter, how can I use the report block?
It would definitely simplify our lives if every block reported a value, as in Lisp. And, even though you were able to solve your problem by just calling an expression, sometimes you do need to call a multi-step script that ends with a report block. To do so, drag a command-shaped ring from the top of the Operators palette into the existing ring slot in CALL, and it'll replace the reporter-shaped one.

Note: Snap! uses applicative order evaluation, and so technically you can't use the Y combinator itself; you have to use the more complicated applicative-order variant. But for most purposes you can just use
http://imageshack.com/a/img924/5965/T0nFcW.png
which, technically, isn't a combinator at all, but gets the job done.

Jonathan50 wrote:

I thought Y combinator was a company that (donated to? somethinged? invested in? uhh) startups.
The company, which invests in startups, was founded by Paul Graham, who made his fortune by getting software projects running a lot faster than his competitors, because he wrote it in Lisp. See http://www.paulgraham.com/avg.html for example. Anyway, he named the company after the lambda calculus recursion operator.
I have an implementation of this here.

The CAPITALBOYS will protect me from kumquats.
~smile~ Y combinator:
define Y(fn)
report ((call (fn) with inputs (fn) [] @delInput @addInput::control)@addInput::grey ring)::control cap

say(call(Y((if <(num) = [0]> then [1] else ((num) x (call (fact) with inputs (fact) ((num)-(1))@delInput @addInput::control)::operators)::control) input names: ((fact)::grey) ((num)::grey) @delInput @addInput :: grey ring)) with inputs [5] @delInput @addInput::control
bharvey
Scratcher
1000+ posts

Snap! user discussion

MichaelOlifant wrote:

Where's the generator project?
What generator project?
I have an implementation of this here.
Indeed. Every time I try to reproduce that without looking it up I get a headache. I see why you have to use λf . f several times, but I can't get them properly nested.

MichaelOlifant
Scratcher
30 posts

Snap! user discussion

bharvey wrote:

MichaelOlifant wrote:

Where's the generator project?
What generator project?
I have an implementation of this here.
Indeed. Every time I try to reproduce that without looking it up I get a headache. I see why you have to use λf . f several times, but I can't get them properly nested.
The one with the yield block.

The CAPITALBOYS will protect me from kumquats.
~smile~ Y combinator:
define Y(fn)
report ((call (fn) with inputs (fn) [] @delInput @addInput::control)@addInput::grey ring)::control cap

say(call(Y((if <(num) = [0]> then [1] else ((num) x (call (fact) with inputs (fact) ((num)-(1))@delInput @addInput::control)::operators)::control) input names: ((fact)::grey) ((num)::grey) @delInput @addInput :: grey ring)) with inputs [5] @delInput @addInput::control
bharvey
Scratcher
1000+ posts

Snap! user discussion

MichaelOlifant wrote:

The one with the yield block.
I'm sorry, I guess I'm slow tonight, but I still have no idea what you're talking about. Some thread I've already forgotten?

MichaelOlifant
Scratcher
30 posts

Snap! user discussion

bharvey wrote:

MichaelOlifant wrote:

The one with the yield block.
I'm sorry, I guess I'm slow tonight, but I still have no idea what you're talking about. Some thread I've already forgotten?
What? You posted it yesterday 14:04:14. 2 P.M. isn't nighttime.

The CAPITALBOYS will protect me from kumquats.
~smile~ Y combinator:
define Y(fn)
report ((call (fn) with inputs (fn) [] @delInput @addInput::control)@addInput::grey ring)::control cap

say(call(Y((if <(num) = [0]> then [1] else ((num) x (call (fact) with inputs (fact) ((num)-(1))@delInput @addInput::control)::operators)::control) input names: ((fact)::grey) ((num)::grey) @delInput @addInput :: grey ring)) with inputs [5] @delInput @addInput::control
MichaelOlifant
Scratcher
30 posts

Snap! user discussion

I have a block for JSON objects:

The CAPITALBOYS will protect me from kumquats.
~smile~ Y combinator:
define Y(fn)
report ((call (fn) with inputs (fn) [] @delInput @addInput::control)@addInput::grey ring)::control cap

say(call(Y((if <(num) = [0]> then [1] else ((num) x (call (fact) with inputs (fact) ((num)-(1))@delInput @addInput::control)::operators)::control) input names: ((fact)::grey) ((num)::grey) @delInput @addInput :: grey ring)) with inputs [5] @delInput @addInput::control
MichaelOlifant
Scratcher
30 posts

Snap! user discussion

bharvey wrote:

MichaelOlifant wrote:

Where's the generator project?
What generator project?
I have an implementation of this here.
Indeed. Every time I try to reproduce that without looking it up I get a headache. I see why you have to use λf . f several times, but I can't get them properly nested.
Of course, my version is

where is the Y combinator-ed variant and the ring is curried.
Equation:
Y = λ f.(λ x.f (x x)) (λ x.f (x x))

The CAPITALBOYS will protect me from kumquats.
~smile~ Y combinator:
define Y(fn)
report ((call (fn) with inputs (fn) [] @delInput @addInput::control)@addInput::grey ring)::control cap

say(call(Y((if <(num) = [0]> then [1] else ((num) x (call (fact) with inputs (fact) ((num)-(1))@delInput @addInput::control)::operators)::control) input names: ((fact)::grey) ((num)::grey) @delInput @addInput :: grey ring)) with inputs [5] @delInput @addInput::control
jokebookservice1
Scratcher
1000+ posts

Snap! user discussion

MichaelOlifant wrote:

bharvey wrote:

MichaelOlifant wrote:

The one with the yield block.
I'm sorry, I guess I'm slow tonight, but I still have no idea what you're talking about. Some thread I've already forgotten?
What? You posted it yesterday 14:04:14. 2 P.M. isn't nighttime.
Timezones…

Hi I'm human and I think you are a nice person hello how are you because I'm good thank you
bharvey
Scratcher
1000+ posts

Snap! user discussion

MichaelOlifant wrote:

What? You posted it yesterday 14:04:14.
I checked through all of yesterday and didn't find a relevant post from myself. I'm so confused.

Are you talking about the thread system in the reference manual?

MichaelOlifant
Scratcher
30 posts

Snap! user discussion

djdolphin wrote:

MichaelOlifant wrote:

Will we use minecraft forge? or is it compatible for 1.11?
It'll use Forge for Minecraft 1.11. I haven't had much time to work on it unfortunately.
I don't see it in YouTube…

The CAPITALBOYS will protect me from kumquats.
~smile~ Y combinator:
define Y(fn)
report ((call (fn) with inputs (fn) [] @delInput @addInput::control)@addInput::grey ring)::control cap

say(call(Y((if <(num) = [0]> then [1] else ((num) x (call (fact) with inputs (fact) ((num)-(1))@delInput @addInput::control)::operators)::control) input names: ((fact)::grey) ((num)::grey) @delInput @addInput :: grey ring)) with inputs [5] @delInput @addInput::control
Scratch_Mapping
Scratcher
100+ posts

Snap! user discussion

How to make this in Snap? Is there a block that does this or do i need to make one?
for ((i)::control) in list [] {
}::control

 :: obsolete
:: #FFFFFF
:: pen
Chibi-Matoran
Scratcher
1000+ posts

Snap! user discussion

Scratch_Mapping wrote:

How to make this in Snap? Is there a block that does this or do i need to make one?
for ((i)::control) in list [] {
}::control
If you select File, then Import tools, you will find a list block called
for each ((item)::list) of [list input] {

}::list
.

If you see this signature while scrolling, you have been visited by ʎ++ haskal. Lazy evaluation, monads, function purity, lambdas, currying, partial application, algebraic data types, pattern matching, and typeclasses will come to you, but only if you comment, “Thanks, ʎ++ haskal” on my profile.

Cassian && ||
MichaelOlifant
Scratcher
30 posts

Snap! user discussion

nathalierun wrote:

Hello,

Here is a summary of a project.
http://nathalierun.net/depotLibre/milieuDyn0.html
I don't understand why I am obliged to put a bloc “Forevor” on sprites A and B to make my project turn correctly.

The time reactivity is very slow…

Thank's for some help.

nathalierun wrote:

The project is here
http://nathalierun.net/depotLibre/Milieu.xml

nathalierun wrote:

Woh ! Thank you…

What I'm trying to do is some dynamical geometric project.
Sprite A is a point. Sprite B another point.
Sprite named M is the midpoint of (A,B).

If you move A or B, M must follow.

Like here :
https://scratch.mit.edu/projects/96670059/
I have a workaround here.

The CAPITALBOYS will protect me from kumquats.
~smile~ Y combinator:
define Y(fn)
report ((call (fn) with inputs (fn) [] @delInput @addInput::control)@addInput::grey ring)::control cap

say(call(Y((if <(num) = [0]> then [1] else ((num) x (call (fact) with inputs (fact) ((num)-(1))@delInput @addInput::control)::operators)::control) input names: ((fact)::grey) ((num)::grey) @delInput @addInput :: grey ring)) with inputs [5] @delInput @addInput::control
xly
Scratcher
100+ posts

Snap! user discussion

nathalierun wrote:
Woh ! Thank you…

What I'm trying to do is some dynamical geometric project.
Sprite A is a point. Sprite B another point.
Sprite named M is the midpoint of (A,B).

If you move A or B, M must follow.

Like here :
https://scratch.mit.edu/projects/96670059/

Look at this : http://snap.berkeley.edu/snapsource/snap.html#present:Username=xleroy&ProjectName=middle
MichaelOlifant
Scratcher
30 posts

Snap! user discussion

I have a project that uses the Pythagorean theorem here.

The CAPITALBOYS will protect me from kumquats.
~smile~ Y combinator:
define Y(fn)
report ((call (fn) with inputs (fn) [] @delInput @addInput::control)@addInput::grey ring)::control cap

say(call(Y((if <(num) = [0]> then [1] else ((num) x (call (fact) with inputs (fact) ((num)-(1))@delInput @addInput::control)::operators)::control) input names: ((fact)::grey) ((num)::grey) @delInput @addInput :: grey ring)) with inputs [5] @delInput @addInput::control
MichaelOlifant
Scratcher
30 posts

Snap! user discussion

bharvey wrote:

Of course what Jens should have done in his EVERY example is this:
http://snap.berkeley.edu/keepevery.png


PS Actually I'm not sure why this works, given that the length of the list isn't divisible by 3. Jens?

PPS I mean, why does it work the second time you click it?
The length of the list isn't divisible by 3. So storing the ring in a variable won't work, but using it explicitly works.

The CAPITALBOYS will protect me from kumquats.
~smile~ Y combinator:
define Y(fn)
report ((call (fn) with inputs (fn) [] @delInput @addInput::control)@addInput::grey ring)::control cap

say(call(Y((if <(num) = [0]> then [1] else ((num) x (call (fact) with inputs (fact) ((num)-(1))@delInput @addInput::control)::operators)::control) input names: ((fact)::grey) ((num)::grey) @delInput @addInput :: grey ring)) with inputs [5] @delInput @addInput::control

Powered by DjangoBB

Standard | Mobile