Weird versions of Booleans

I only have 1 category for weird Booleans, “Can it be this but not that?”
List of blocks in the category:

can [] be [] but not []? ::#925200 reporter
<t> Heres the guy: [] ::#925200 reporter
equal to [] ::#925200 reporter

anything ::#925200 reporter
can [] not be []? ::#925200 reporter

[] can it??\
if yes:{
} if not:{
} ::#925200 

You can suggest ideas for new categories and their blocks.

You forum guys are too much in love with metaprogramming, to the point of forgetting the strength of plain old Snap! way back to BYOB 3.0.

You have

Here’s my version:

At first glance this doesn’t look adequate:


The 5 seems not to be in the reported predicate. But when you put a ring around a block, the resulting function remembers the environment in which it was created:

weird booleans script pic (3)

weird booleans script pic (4)

weird booleans script pic (5)

How will a block, like can [] be [] but not [] ::#925200 reporter, detect the 5 in equal to [5]::#925200 reporter if all it reports is {[] = (x ::variables) @<:>} @> ::ring ?

Whenever a custom block or procedure is called, it creates a new local scoping. So the variable x is “remembered” within the procedure.

Theres this really good section in the Snap! manual about “make-adders”, I reccomend you read that.

where is that?

Chapter 8 of the Snap! manual: OOP with Procedures

By calling the block! You don’t have to see the 5 in the visible code; the block will remember it and do the right thing.

That’s also a great example, but it was different. It was like

(make-adder((n)) ::operators) ::define+
report ( ((n) + ()) $>)

And calling MAKE-ADDER 3 would give you a new function which reports its input + 3.

No, it’s the same, just = instead of +.

Ok.