# More logic gates: NAND, XOR, XNOR, NOR

Logic gates are essential. So, it makes sense we finish the collection. It's gonna be a quick addition, but if it's already in a library, tell me. I'm too lazy to check at the time of posting this. Even if these gates are in a library, Snap! needs to add them as a primitive. Just a suggestion.

Hi, welcome to the forum!

Side comment: This is the first time I've seen the abbreviation XNOR, which (if I'm understanding correctly) is the same operator as =.

All the other Boolean operators can easily be defined in terms of the ones we have, e.g.,

Sometimes we add as primitive something that could be written in Snap! itself because it's a lot faster as a primitive, but that's not the case here. And writing them is an exercise in BJC. :~)

A more advanced exercise: Write a function BOOLEAN that takes a truth table as input and reports the corresponding dyadic predicate, so for example

would report an equivalent function to AND.

Then you can have all 16 dyadic Boolean operators!

How many Logic Gates are there IRL? The only ones I know are the AND gate, the NOT gate, the NOR gate, the OR gate, and the NAND gate

If you're talking about hardware, I don't think anyone makes anything as low-level as a Boolean gate anymore. Maybe you can still buy an Arithmetic-Logic Unit (ALU), but most likely you have to get the whole CPU now.

We don't include the Boolean operators for the sake of simulating hardware; we have them to support complicated test conditions in IF and friends.

In my youth the best scientific computer (≈\$2M) was the DEC PDP-10, which had all 16 Boolean operators as machine language instructions. :~)

XNOR is "eXclusive Not OR". Its truth value is:

. F T
F | T F
T | F T

So, you are correct in saying:

I'm a teacher; I'm always right. :~)

Almost always. After all, nobody can be always correct.

There was a smiley!

Every smiley you make seems to have a tilde "~" as a nose.

That's to prevent stupid Discourse turning them into emoji. Smileys are an opportunity for creativity; people keep inventing new kinds, such as the use of 8 either for eyeglasses or for propeller beanies, and the wonderful ¯\_(ツ)_/¯ shrug. Emoji are entirely lazy, apart from the people at places like Apple who draw them. The original idea of sideways ASCII-art was a brilliant piece of creativity!

:-)

Clever, but when I quote it, it turns into an emoji.

Clicking the Quote whole post button (left-most button):

Selecting visible text and clicking the " Quote button that pops-up

Wait, I just figured something out! :)

:</span>)


Seems like </span> can negate a lot of css.

:-)
It works! :)

In words:
overline backslash underscore openParenthesis katakanaTsu closeParenthesis underscore slash overline

Bc discourse uses span a lot

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