Snap [scratchblocks] Tutorial (Part 2)

There is a source code of the Discourse plugin with Tim code embedded: dardoro.github.io/discourse-scratchblocks/common/head_tag.html at master · DarDoro/dardoro.github.io · GitHub
It was a quick'n'dirty attempt with hardcoded values,so there is a room for improvements.

var doc = scratchblocks.parse( sblocks, { lang :"en" ,style :"scratch2",languages : ["en"] });
var docView = scratchblocks.newView( doc, { style : "scratch2" });

Mathematically, a "set" differs from a programming-style list in two ways: (1) it's unordered; there's no such thing as the index of an item. (2) The elements of a set are unique; you can't have a set {a, b, a} but that's a perfectly good list. So yeah, "everyone in this thread" is a set.

That describes Python sets exactly.

Of course they're probably implemented as arrays, just as lists are, but with constraints imposed. Although sets from a small universe are sometimes implemented as bit streams, so if the universe is planets in the solar system, the set {Earth, Jupiter} would be represented as 00101000 supposing the planets are ordered in the usual distance-from-sun way.

Wouldn't the Earth be 0011 in there to account for the Sun being able to be in that set?

Earth is the third planet, but sure, if you want to include Sol in the set, Earth would be 0001.

?

Each planet is one bit.

Mercury = 10000000
Venus = 01000000
Earth = 00100000
Mars = 00010000
Jupiter = 00001000
etc.

To make a set, you just add the planet numbers, i.e., you turn on each planet's bit. (If you want to include Sol, just put a zero at the left of each of these numbers.)

That's very inefficient for storing many different sets of planets. Plus, someone might want to include Pluto, or Ceres, or moons, or other heavenly bodies.

As I said at the beginning of this subthread, it's a technique that's used when there's a small fixed universe from which sets are chosen. Think days of the week, in a calendar program that allows you to set up a meeting every Tuesday and Saturday. Or days of the month, which just barely fit in a 32-bit word.

The thing is, when a set is represented in one computer word, it becomes really fast to copy a set, and there are machine instructions to find the union or intersection of two sets in one step (OR and AND, respectively).

And now that we have 64-bit-wide computers, we can do the same thing for sets of states (in the US, 50 or 52 of them if you count Washington DC and Puerto Rico).

50 out of 64 = 0.78125 or 78.125 percent. 21.875% remaining. (I may not be thinking of the right thing)

So we can add 14 more states, I guess. There's talk of splitting California in half, mainly so Californians would have more representation in the Senate. :~)

[scratchblocks]
asdfghjkl hat cat block :: hat cat
operators cap cat :: operators cap cat
a list cat but it doesn't work :: list cat
probably scratchblocks 2.0 making cat just a synonym for hat and this is a very long list hat cap hat cap block :: list hat cap hat cap
an ((abcdefghijklmnopqrstuvwxyz) :: list) upvar :: list cap hat
(+split+((text ¶) :: operators)+by+((delimiter) :: operators)+ :: operators reporter) :: control hat
report (split (text) by (delimiter) :: operators) :: control cap
[/scratchblocks]

I found a scratchblocks testing area here, and with it I made this:
scratchblocks
{ :: list cat} @addInput :: grey ring
No cat blocks in scratchblocks for Scratch 2.0, though:
[scratchblocks]{ :: list cat} @addInput :: grey ring[/scratchblocks]

Probably. *cat block meows with 3.X*

*desperately codes grey ring hat block

how to make cap block
how

In scratchblocks? block name :: cap

[scratchblocks]
testing... {when flag clicked
say [MOEW]
if <(a) = (s)> then
say [a = s]
end
tell (variable watcher for [var v] :: variables) to ({forever
update watcher (my [self v] :: sensing) :: variables
} @addInput :: grey ring) :: control
} testing :: grey ring
[/scratchblocks]

good.
now put in a run javascript function like this:
run(javascript function[proc]<||>(whatever you like))with inputs testing... testing