Learn to Code via Tutorials on Repl.it!

← Back to all posts
Lets learn APL! Part 3
TheForArkLD (770)

Lets learn APL part3!( i dont write more japanese,im japanese but its make tired to me)
Today lesson is Logic gates and boolean.
First,i description the logic gates.
Uh why?
Probably you dont know logic gates.

Please remember this : We have 2 inputs for logic gates,name is A and B
1st is AND Gate,When A and B is 1 to OUT is true.
2nd is OR Gate,When A is 1 or B is 1 or A and B is 1 to OUT is true.
3rd is NOT Gate(Its use one input only,name is IN),When IN is 0 to OUT is true.
NOTE : In NOT Gate,other is false
4th is XOR Gate,When A is 1 and B is 0 or A is 0 and B is 1 to OUT is true.
Note : You can make NAND and NOR and XNOR,but how to?Use NOT Gate and other gate.
Example : NAND is NOT + AND

Ok,Please remember their gates.

Ok lets code APL!
And remember this rules.

1.Dont use Not Boolean on Gates,When you use to its return DOMAIN ERROR

1st,Logic Gate is NOT.
Use ~ to Get NOT Gate Data,And you can use array on NOT Gate.

     ~ 0 1 0 1 1 0
1 0 1 0 0 1

2nd Gate is AND(XNOR) Gate.
(Yay its can use on not Boolean)
Use = to get AND Gate Data,And you can use Array on All Gates.

     1 0 1 1 0 = 0 1 0 1 0
0 0 0 1 0

3rd Gate is XOR Gate.( I dont know OR Gate code sorry and its can use not boolean.)
Use to get XOR Gate Data.

     1 0 1 0 1 ≠ 0 1 1 0 1
1 1 0 0 0

Its easy,1 is true,0 is false.

Today lesson is end.
Thanks for viewing my lesson :)
When you have questions to ask me :)

CSharpIsGud (1021)

I believe you have a typo in the section on and gates
1 0 1 1 0 AND 0 1 0 1 0 should equal 00010 not 00011

theangryepicbanana (1697)

Hey do you know where I'd find a list of APL operators/functions that describe if they are monadic/dyadic/something else? All I've found is the wikipedia entry, which is kinda outdated.

theangryepicbanana (1697)

@TheForArkLD Thanks that really helped :D I've been working on APL highlighting for repl.it so I needed to know what to highlight