Weird blocks

what do the blocks here do?

the grey blocks are for codification support. you can load the codification sample project to see how to use them.

The pen vectors block is like the pen trails block, but it reports the pen trails as a vector image (if you have log pen vectors enabled)

the ≥ is like > but it checks if the number is equal to or bigger than the second one, same with ≤ but with less then instead.

the min reporter (I didn't know they actually added that, it's super easy to remake) reports the first input if it's less than the second one, and it reports the second one if the first one is bigger. Same with the max reporter but with less then instead of bigger than

I'm not sure what the atan2 reporter does, but here's a Wikipedia article about atan2 https://en.wikipedia.org/wiki/Atan2

the rest are for debugging purposes in dev mode, but if you really want, I could tell you what they all do.

thanks!

you're welcome, and now that you bring up those blocks, I guess I'll have to add them to the snap wiki

ok (and can you provide a link to the wiki pages?)

Simpler from what ive seen in the example projects:

They allow u to convert objects ti text

(BLOCKS: to a text programming lang

yeah, but it shows you that in the codification sample project

Explanations for (most of) the dev mode blocks:
alert: Only works in dev mode. Alerts a list of texts in the browser.
console log: Logs texts to the console.
show table: Most likely used in the inner workings of Snap!. Shows a list by table view.
stack size: Reports the size of the block stack the reporter is currently in.
processes: Reports the amount of processes in the project (i.e. forever loops).
frames: No idea.
type of: Returns the type of a piece of data.
[] of []: Encodes/decodes a string.

Like all the recent cases of new primitives that are easy to write in Snap!, the point is that they're hyperblocks, and as such they're useful in media computation.

It's because they're good programming exercises that those blocks aren't in the palette; you have to Relabel another arithmetic or Boolean operator, as appropriate, to get them.

It's exactly like atan(x/y), except for the case y=0, in which case it can't do the division, but the corresponding angle is perfectly well defined; it reports 90 if x>0 or -90 if x<0.

Most of the ones you don't understand aren't part of the Snap! innards, but rather are used by Jens to help debug new code in the Snap! innards.

A forever loop is one process, unless you have a bunch of clones running it at once.

A frame is a collection of bindings from names to variables. (For most purposes you can think of it as "from variable names to variable values" but sometimes you have different variables with the same name in different procedures, and sometimes you have different names for the same variable, as when you rename an upvar outside of where it's declared.)

I didn't think of that.

I don't know what atan is either. I haven't gotten to that part in math yet.

Ah. If you haven't done trig, don't worry about it.

I haven't done trig, so, ok.

atan2 can be used to get the angle of like a line represented by one or two points (if the line is represented by one point then the other end would be (0, 0))

well that is a strange feature

Yeah, it's ungainly, like all compromises.

This topic was automatically closed 30 days after the last reply. New replies are no longer allowed.