[Question]
  [
[Logic gates](https://en.wikipedia.org/wiki/Logic_gate) are functions which perform basic logic operations. In this problem, we will account for the following 6 logic gates: `AND`, `OR`, `XOR`, `NAND`, `NOR`, and `XNOR`. Each of these takes two boolean inputs \$ a \$ and \$ b \$, and outputs a boolean. Below are the truth tables which show the output of each gate given two inputs.
[![enter image description here](https://i.stack.imgur.com/U89H0.jpg)](https://i.stack.imgur.com/U89H0.jpg)
## Task
Given two boolean inputs \$ a \$ and \$ b \$, return/output a list of the names of all gates which would return a Truthy value. The order doesn't matter, but the names must be in the exact format as given in the 2nd sentence of the above paragraph (not the ones in the diagram). You are also allowed to output them exclusively in lowercase, if desired.
## Clarifications
* You may also output a delimiter-separated string
* I will allow leading/trailing spaces
## Test Cases
### Input
```
0 0
0 1
1 0
1 1
```
### Output
```
[NOR, NAND, XNOR]
[OR, NAND, XOR]
[OR, NAND, XOR]
[OR, AND, XNOR]
```
This is [code-golf](/questions/tagged/code-golf "show questions tagged 'code-golf'"), so the shortest code in bytes wins!
  
[Answer]
# [Python 3](https://docs.python.org/3/), ~~53 50~~ 49 bytes
*Thanks @JonathanAllan for saving 1 byte!*
```
lambda a,b:"NOR N"[a|b:5-a*b]+"AND X"+"NOR"[a^b:]
```
[Try it online!](https://tio.run/##K6gsycjPM/6fpmAb8z8nMTcpJVEhUSfJSsnPP0jBTyk6sSbJylQ3USspVlvJ0c9FIUJJGyQFlIhLsor9X1CUmVeikaZhoKNgoKnJhcQ1ROIaosoagmX/AwA "Python 3 – Try It Online")
[Answer]
# [J](http://jsoftware.com/), 46 bytes
```
;:@'AND NAND OR NOR XOR XNOR'#~*,*:,+.,+:,~:,=
```
[Try it online!](https://tio.run/##y/qvpKeepmBrpaCuoKNgoGAFxLp6Cs5BPm7/ra0c1B39XBT8QIR/kIIfEEeAMJChrlynpaNlpaOtp6NtpVNnpWP7X5MrNTkjH6g/TcEAwTSEMA0RoiCm4X8A "J – Try It Online")
*-5 bytes thanks to Bubbler*
We execute a train `*,*:,+.,+:,~:,=` corresponding to the gates on the arguments, which will produce a single boolean mask of the results.
We then apply that mask as a filter `#~` on the list of words, which is in the same order.
*Note:* Since the returned strings of are of unequal length, J requires them to be boxed.
[Answer]
# [Ruby](https://www.ruby-lang.org), 49 bytes
```
->a,b{"#{?N[a|b]}OR #{?N[a&b]}AND X#{?N[a^b]}OR"}
```
[Try it online!](https://tio.run/##KypNqvyfZhvzX9cuUSepWkm52t4vOrEmKbbWP0gBwlEDchz9XBQiINw4sJxS7f@S1OKSYgVbhWguBYVoAx0Fg1gdKMsQwjKEixmCxLhi9VITkzMUqhVqSmoUChTSorVKYhVq/wMA "Ruby – Try It Online")
Interpolates `'N'` into the output string conditionally for each gate.
Alternatively, a direct port of @Surculose Sputum's excellent [Python answer](https://codegolf.stackexchange.com/a/203983/92901) (be sure to upvote it!) is also 49 bytes:
```
->a,b{"NOR "[a|b,4]+"NAND X"[a&b,6]+"NOR"[a^b,3]}
```
[Try it online!](https://tio.run/##KypNqvyfZhvzX9cuUSepWsnPP0hBKTqxJknHJFZbyc/Rz0UhAshXS9IxA/H9g4CcuCQd49ja/yWpxSXFCrYK0VwKCtEGOgoGsTpQliGEZQgXMwSJccXqpSYmZyhUK9SU1CgUKKRFa5XEKtT@BwA "Ruby – Try It Online")
[Answer]
# Python 2.7, ~~117~~ ~~111~~ ~~102~~ 98 bytes
*-6 bytes thanks to @math junkie!  
-13 bytes thanks to @Surculose Sputum!*  
  
[Try it online!](https://tio.run/##XY3BCgIhFEX37ysebxEKQ4zRSvBLYog35pQQT1GD6evNWrY5XDhwbn63R5JT9@iQiDpPq4uSX01pqI5SQWG54Z4KQdyQnVttdfVYQn6yD4oSTSSJ9M8e/qTwsEz6YuwCuURpWPu4gW2ErxgFC8s9qLO2gBj24NH3ecIZBgyY7xowHw)
Probably could be made shorter with `lambda` but I don't know how to use it:
```
a,b=input()
s="or nand xor"
if a==b:s=s.replace("o","no")
if a&b:s=s.replace("na","a")[1:]
print s
```
EDIT: Yep. This program uses string manipulation to solve the problem, which I thought was simpler, but now I'm not so sure.
[Answer]
# [J](http://jsoftware.com/), ~~39~~ 37 bytes
```
[:;(_5<\'NAND NOR XNOR')}.~&.>*,+.,~:
```
[Try it online!](https://tio.run/##y/qvpKeepmBrpaCuoKNgoGAFxLp6Cs5BPm7/o62sNeJNbWLU/Rz9XBT8/IMUIoCEumatXp2anp2WjraeTp3Vf00urtTkjHygvjQFAwTTEMI0RIiCmIb/AQ "J – Try It Online")
-2 bytes thanks to @Jonah.
A solution that pretty much works like [Surculose Sputum's Python 3 answer](https://codegolf.stackexchange.com/a/203983/78410).
### How it works
```
NB. The three segments in the new version
_5<\'NAND NOR XNOR'
    'NAND NOR XNOR'  NB. a length-13 string
_5<\                 NB. enclose non-overlapping length-5 chunks
      (which works because the three N's to filter appear at indexes 0, 5, 10)
NB. Previous version
[:;('NAND ';'NOR X';'NOR')}.~&.>*,+.,~:  NB. Input: two bits as left/right args
                                *,+.,~:  NB. evaluate AND, OR, XOR
   ('NAND ';'NOR X';'NOR')               NB. corresponding three segments
                             &.>  NB. pair up both sides unboxed and
                          }.~     NB.   drop the first char from left if right is 1
[:;  NB. Remove boxing and concatenate into a single vector
```
[Answer]
# [05AB1E](https://github.com/Adriandmen/05AB1E), 28 bytes
```
.•UNœ5Z’dµ•#εI…PàONè.Vi'nõ.;
```
[Try it online!](https://tio.run/##yy9OTMpM/f9f71HDolC/o5NNox41zEw5tBXIVT631fNRw7KAwwv8/Q6v0AvLVM87vFXP@v//aEMdBcNYAA "05AB1E – Try It Online")
[Answer]
# JavaScript (ES6), 55 bytes
```
a=>b=>'1OR 3AND X5OR'.replace(/\d/g,n=>n>>a+b&1?'N':'')
```
[Try it online!](https://tio.run/##y0osSyxOLsosKNHNy09J/Z9m@z/R1i7J1k7d0D9IwdjRz0UhwtQ/SF2vKLUgJzE5VUM/JkU/XSfP1i7Pzi5RO0nN0F7dT91KXV3zf3J@XnF@TqpeTn66RpqGgSYQaXJhCBpiCBpiU2kIVvkfAA "JavaScript (Node.js) – Try It Online")
### How?
For each gate type, we use the sum of \$a\$ and \$b\$ to right-shift a bit mask. We test the least significant bit of the result to find out if we must return the complementary form of the gate.
```
   a  | 1 | 0 | 1 | 0 |
   b  | 1 | 1 | 0 | 0 |
------+---+-------+---+---------
  a+b | 2 |   1   | 0 | decimal
------+---+-------+---+---------
  NOR | 0 |   0   | 1 |    1
 NAND | 0 |   1   | 1 |    3
 XNOR | 1 |   0   | 1 |    5
```
---
# JavaScript (ES6), 55 bytes
Using a template literal is just as long.
```
a=>b=>['N'[a|b]]+`OR ${['N'[a&b]]}AND X${['N'[a^b]]}OR`
```
[Try it online!](https://tio.run/##y0osSyxOLsosKNHNy09J/Z9m@z/R1i7J1i5a3U89OrEmKTZWO8E/SEGlGiKgBhSodfRzUYiAicSBRPyDEv4n5@cV5@ek6uXkp2ukaRhoApEmF4agIYagITaVhmCV/wE "JavaScript (Node.js) – Try It Online")
[Answer]
# [C (gcc)](https://gcc.gnu.org/), ~~65~~ ~~60~~ 58 bytes
```
f(a,b){printf("NOR %s X%s"+(a|b),"NAND"+a*b,"NOR"+(a^b));}
```
[Try it online!](https://tio.run/##S9ZNT07@/z9NI1EnSbO6oCgzryRNQ8nPP0hBtVghQrVYSVsjsSZJU0fJz9HPRUk7UStJByQLEo5L0tS0rv2fm5iZp6FZzZWmYaCjYKBpraCvpQDSD9KgEAFiaelzwQyOyVPStIYoNYQohavErtAQbiZhhQgTka2u/Q8A "C (gcc) – Try It Online")
[Answer]
# [brainfuck](https://github.com/TryItOnline/brainfuck), 234 bytes
```
>-[-[-<]>>+<]>-[<<++>+>-]<<+<<<-[+>++[++<]>]>-->>[>>>>[-]<<<<[>>+>>+<<<<-]<]<<,<,[>+<-]>[>+>+>>+<<<<-]>>>>--[>.<[-]]>>.>.>+++.>.[<]<<[>>+<<-]>+>[<[-]>[-]]<[->+<]>[>.<[-]]>+.+++.<<<<[>>>+<<<-]>>>>>>>>.<<<<++++++.<-[>>>.<<<[-]]>>>+.+++.
```
[Try it online!](https://tio.run/##TU5BCsMwDKPvUZ0XCH9E5NAOBmOww2Dvz@Q0jNmQWJZk@3wfj9f9c3uOkSEneyb8hEggkdFdkAwZQSjSdGQqHSqedI0ylrDTrZ27jKNbhj@uPBHKRjuNmhOAP5VNU2gZUqWo@d3FvOnnQivL2jsnX4MrZhszmo9enWvZMo6xbV8 "brainfuck – Try It Online")
Takes input as two bytes (0 or 1) on stdin, outputs space-separated to stdout without trailing whitespace.
The TIO link has the `11` test case because I couldn't figure out how to type the null character into a web browser, but if you delete the second input character it will do the same thing as the `10` test-case, and if you delete both it will be the same as the `00` test-case.
Here's my annotated version (the two input bytes are `b` and `a`, their sum is `c`):
```
-[-[-<]>>+<]>- *32* from https://esolangs dot org/wiki/Brainfuck_constants#32
[<<++>+>-]      64 32 *0*
<<+<<<            *0* 0 0 65 32
-[+>++[++<]>]>-- *78* 65 32 from https://esolangs dot org/wiki/Brainfuck_constants#78
>>
 [>>>>[-]<<<<[>>+>>+<<<<-]<] 0 *0* 0 0 78 65 78 65 32
<<
,<,          *b* a     0 0 0 0 78 65 78 65 32
[>+<-]>      0 *b plus a=c* 0 0 0 0 78 65 78 65 32
[>+>+>>+<<<<-]>>>> 0 0 c c 0 *c* 78 65 78 65 32
--                      0 0 c c 0 *c minus 2* 78 65 78 65 32
[>.<[-]]>>.>.>+++.>.    0 0 c c 0 0   78 65 78 *68* 32    (N)AND space  print N if c != 2
[<]<<[>>+<<-]>>         0 0 c 0 0 *c* 78 65 78 68 32
<+>[<[-]>[-]]<[->+<]>   0 0 c 0 0 *!c* 78 65 78 68 32 
[>.<[-]]>+.+++.         0 0 c 0 0 0  *82* 65 78 68 32     (N)OR         print N if c == 0
< <<<[>>>+<<<-]>>>      0 0 0 0 0 *c* 82 65 78 68 32
>>>>>.<<<<++++++.<      0 0 0 0 0 *c* 88 65 78 68 32      space X
-[>>>.<<<[-]]           0 0 0 0 0 *0* 88 65 78 68 32      (N)           print N if c != 1
>>>+.+++.               0 0 0 0 0 0   88 65 *82* 68 32
```
[Answer]
# [Retina 0.8.2](https://github.com/m-ender/retina/wiki/The-Language/a950ad7d925ec9316e3e2fb2cf5d49fd15d23e3d), 37 bytes
```
00
N2N
11
ODN
\d+
OND
D
AND X
O|$
OR 
```
[Try it online!](https://tio.run/##K0otycxL/K@q4Z7w38CAy8/Ij8vQkMvfxY8rJkWby9/PhcuFy9HPRSGCy79Ghcs/SOE/SJmhAZeBIVAhAA "Retina 0.8.2 – Try It Online")
Input is as a single 2-digit string (one of `00`, `01`, `10`, or `11`). Performs a series of replacements to arrive at the required output.
**Explanation**
`AND X` is a string common to all 4 outputs, so we encode the string as `D`.
`OR` appears in a bunch of places so we encode that as `O`.
Then, we can replace each pair of digits with a string of `N`s, `O`s and `D`s. (The `00 -> N2N` and the `\d+ -> OND` are golfs arising from `10` and `01` yielding the same output and sharing some overlap with the output for `00`.
Finally, we just replace the `O`s and `D`s with the expanded string mentioned above and we get the required list!
[Answer]
# [Pyth](https://github.com/isaacg1/pyth), 37 bytes
```
AQ%"%sOR X%sOR %sAND"*R\N!M[|GHxGH&GH
```
[Try it online!](https://tio.run/##K6gsyfj/3zFQVUm12D9IIQJMqhY7@rkoaQXF@Cn6Rte4e1S4e6i5e/z/H@2WmFOcqqMApmIB "Pyth – Try It Online")
Takes a list of two values as input, outputs in the form `AND OR XNOR`
### Explanation
```
AQ                                     # Q is the input. Set G:=Q[0], H:=Q[1]
  %                                    # Format a string (printf-style)
   "%sOR X%sOR %sAND"                  # Format string
                     *R\N!M[|GHxGH&GH  # replacement values as a list:
                           [           # [                        ]
                            |GH        #  G or H                   
                               xGH     #          G xor H          
                                  &GH  #                   G and H 
                         !M            # map each to its negation
                     *R\N              # map each x to "N"*x
```
(Ab)uses the fact that in Python and thus Pyth, `True == 1` and `False == 0` and thus `"N"*True == "N"` and `"N"*False == ""`.
[Answer]
# [Jelly](https://github.com/DennisMitchell/jelly), 23 [bytes](https://github.com/DennisMitchell/jelly/wiki/Code-page)
```
S11,:Sµ“×®ṫ.¡Ḍẹhɗ»x€⁸¦0
```
A monadic Link accepting a list of two integers (in `[0,1]`) which yields a list of characters - the gate names separated by spaces.
**[Try it online!](https://tio.run/##ATkAxv9qZWxsef//UzExLDpTwrXigJzDl8Ku4bmrLsKh4biM4bq5aMmXwrt44oKs4oG4wqYw////WzAsMF0 "Jelly – Try It Online")** Or see the [test-suite](https://tio.run/##y0rNyan8/z/Y0FDHKvjQ1kcNcw5PP7Tu4c7VeocWPtzR83DXzoyT0w/trnjUtOZR445Dywz@H91zuB3IywKJNMy1ivz/P9pAxyBWB0gaAklDMNsQyAYA "Jelly – Try It Online").
### How?
Observe that there are three outputs, aligning with the sums and that the sum \$1\$ and sum \$2\$ outputs are the sum \$0\$ one missing certain characters. When one-indexed the sum \$1\$ needs characters `1` and `11` removed while the sum \$2\$ one needs characters `1` and `5` removed. Furthermore \$\lfloor \frac{11}{2} \rfloor = 5\$.
```
S11,:Sµ“×®ṫ.¡Ḍẹhɗ»x€⁸¦0 - Link: list of integers, B  e.g [0,0]            [1,1]            [1,0] (or [0,1])
S                       - sum (B)                        0                2                1
 11                     - literal eleven                 11               11               11
   ,                    - pair                           [11,0]           [11,2]           [11,1]
     S                  - sum (B)                        0                2                1
    :                   - integer division               [inf,nan]        [5,1]            [11,1]
      µ                 - start a new monadic link, call that X
       “×®ṫ.¡Ḍẹhɗ»      - compressed string              "NOR NAND XNOR"  "NOR NAND XNOR"  "NOR NAND XNOR"
                   € ¦  - sparse application...
                    ⁸   - ...to indices: chain's left argument
                  x   0 - ...action: repeat zero times   "NOR NAND XNOR"  "OR AND XNOR"    "OR NAND XOR"
```
[Answer]
# [Bash](https://www.gnu.org/software/bash/) + Core utilities, ~~53~~ 49 bytes
```
tr 01 N\\0<<<"$[$1|$2]OR $[$1&$2]AND X$[$1^$2]OR"
```
[Try it online!](https://tio.run/##RY4xC8IwEIX3@xWPEFxEbZxrQVDHFpwEq5CkrXVoIrGCg/89JqXWG@7efY93nJLP1mvZI3s4e3OyQ5qyfXFgvndIBPKyTNKA@JmLD19fiiOinAW5zXc4xeU6cOZDjEi3na3wmr8xHiRqrIPE3SCBIKCyoQGRqj@NNTqxat1aLAwYl@AKmwxs8par36@DOYVNTeP0Xw "Bash – Try It Online")
This is a full program. Input is passed as arguments, and the output is written to stdout.
[Answer]
# [APL (Dyalog Unicode)](https://www.dyalog.com/), 30 [bytes](https://codegolf.meta.stackexchange.com/a/9429/78410)
```
∊'NAND ' 'NOR X' 'NOR'↓⍨¨∧,∨,≠
```
[Try it online!](https://tio.run/##SyzI0U2pTMzJT////1FHl7qfo5@LgrqCup9/kEIEhFZ/1Db5Ue@KQysedSzXedSxQudR54L/aY/aJjzq7XvU1XxovfGjtomP@qYGBzkDyRAPz@D/QNo5Ur04MadEXeFRd4tCal5iUk5qsKNPCFdsUn5FZl66Qn4el4GCocKjjhl6aQpAFgA "APL (Dyalog Unicode) – Try It Online")
A port of [my own J answer](https://codegolf.stackexchange.com/a/203992/78410).
### How it works
```
∊'NAND ' 'NOR X' 'NOR'↓⍨¨∧,∨,≠
                         ∧,∨,≠  ⍝ AND, OR, XOR
 'NAND ' 'NOR X' 'NOR'↓⍨¨       ⍝ Drop an N from the string segments at ones
∊                               ⍝ Flatten
```
[Answer]
# [05AB1E](https://github.com/Adriandmen/05AB1E), 42 bytes
```
.•Vs’9ìï´¸•.•B»Î5γ'¸•DŠ‚s.•B»¯4qld•‚«IðмCè
```
[Try it online!](https://tio.run/##yy9OTMpM/f9f71HDorDiRw0zLQ@vObz@0JZDO4ACIEGnQ7sP95me26wOFnE5uuBRw6xiqMSh9SaFOSlANlDs0GrPwxsu7HE@vOL/f0MFQwA "05AB1E – Try It Online")
Makes a list: `["nor nand xnor", "or nand xor", "or nand xor", "or and xnor"]`; the input is read as a binary number and that corresponds to the position in the list. This could probably be reduced heavily as I see the other 05ab1e answer just uses `"nand nor xnor"` as its string.
[Answer]
# x86-16 machine code, IBM PC DOS, ~~57~~ 52 bytes
**Binary:**
```
00000000: a182 0025 0101 8bd8 ba2f 0152 0ac4 7401  ...%...../.R..t.
00000010: 42b4 09cd 21ba 2801 84df 7401 42cd 215a  B...!.(...t.B.!Z
00000020: 32df 7401 42cd 21c3 4e41 4e44 2058 244e  2.t.B.!.NAND X$N
00000030: 4f52 2024                                OR $
```
**Listing:**
```
A1 0082     MOV  AX, [0082H]        ; load command line chars into AH/AL 
25 0101     AND  AX, 0101H          ; ASCII convert 
8B D8       MOV  BX, AX             ; save input to BX for later 
BA 012F     MOV  DX, OFFSET NOR     ; DX = string 'NOR' 
52          PUSH DX                 ; save 'NOR' for later 
0A C4       OR   AL, AH             ; OR or NOR? 
74 01       JZ   OUT_NOR            ; is OR? 
42          INC  DX                 ; increment string pointer to skip 'N' 
        OUT_NOR: 
B4 09       MOV  AH, 9              ; DOS write string function 
CD 21       INT  21H                ; write to STDOUT 
BA 0128     MOV  DX, OFFSET NAND    ; DX = string 'NAND X' 
84 DF       TEST BL, BH             ; AND or NAND? 
74 01       JZ   OUT_NAND           ; is AND? 
42          INC  DX                 ; increment string pointer to skip 'N' 
        OUT_NAND: 
CD 21       INT  21H                ; write string to STDOUT 
5A          POP  DX                 ; Restore DX = 'NOR' 
32 DF       XOR  BL, BH             ; XOR or XNOR? 
74 01       JZ   OUT_XOR            ; is OR? 
42          INC  DX                 ; increment string pointer to skip 'N' 
        OUT_XOR: 
CD 21       INT  21H                ; write string to STDOUT 
C3          RET                     ; return to DOS
    NAND    DB  'NAND X$' 
    NOR     DB  'NOR $'
```
A standalone PC DOS executable. Input via command line, output string to `STDOUT`.
**I/O:**
[![enter image description here](https://i.stack.imgur.com/p2hKQ.png)](https://i.stack.imgur.com/p2hKQ.png)
[Answer]
# [OIL](https://github.com/L3viathan/OIL), 81 bytes
```
5
1
5
NAND OR XOR
10
NAND NOR XNOR
1
9
20
10
AND OR XNOR
6
14
17
4
10
3
4
5
3
4
3
```
As usual with golfed OIL code, we use cells as both data and code. All the strings also serve as references to the cell #0 (which will later contain the second input), and we use cell #6 (the one containing a `1`) as both a reference to cell #1, as well as the value `1`.
[Answer]
# [Aceto](https://github.com/aceto/aceto), 67 bytes
```
pdA`ANpn
"Ln>"D"L
RON'  Ov
 "p   Vu
p^`p"pX
N''XRO
irHL "<`
riMdpN'
```
[Try it online!](https://tio.run/##S0xOLcn//78gxTHB0a8gj0vJJ89OyUXJhyvI309dQcG/jEtBqUBBQSGslKsgLqFAqSCCy09dPSLInyuzyMNHQckmgaso0zelwE/9/39DLgMA "Aceto – Try It Online")
---
I'm using quick storage for one of the inputs, the stack for the other. It's mostly conditionally escaped movement to avoid printing `N`, but I also used the reverse-and-jump-to-the-end trick for a few saved bytes.
[Answer]
## Common Lisp, 154 bytes
Not a short answer, but relies on [`BOOLE`](http://clhs.lisp.se/Body/f_boole.htm), which is a function that is practically never used:
```
(lambda(a b)(loop for(n o)in`((and,boole-and)(nand,boole-nand)(or,boole-ior)(nor,boole-nor)(xor,boole-xor)(xnor,boole-eqv))if(/=(boole o a b)0)collect n))
```
Readable version:
```
(loop
   for (name op) in `((and  ,boole-and)
                      (nand ,boole-nand)
                      (or   ,boole-ior)
                      (nor  ,boole-nor)
                      (xor  ,boole-xor)
                      (xnor ,boole-eqv))
   unless (= (boole op a b) 0)
   collect name)
```
All couples `(name op)` in the list are made of `name`, a symbol used for the output, and `op`, a constant integer value that represents a particular boolean operation. 
The `boole` functions knows how to perform the operation based on such value. Note that `xnor` is the equivalence operation, namely `boole-eqv`.
The loop builds a list of names such that the associated operation yields a non-zero result.
Indeed, if you do:
```
(boole boole-nand 1 1)
```
The result is `-2`, a.k.a. `-10` in binary; this is because those operations assume an *infinite* two's complement representation (<https://comp.lang.lisp.narkive.com/OXYD1hNK/two-s-complement-representation-and-common-lisp>)
[Answer]
# [Python 3](https://docs.python.org/3/), 60 bytes
Not really close to the gold, but found it interesting that just picking from the list of options is within 11 bytes of the best python answer, and more than 30 bytes smaller than the other python answer. Shows how impressive golfing those 11 bytes are imo.
Also shorter than some other langs that i think could also implement the same method.
```
lambda a,b:['nor nand xn','or nand x','or and xn'][a+b]+'or'
```
[Try it online!](https://tio.run/##K6gsycjPM/6fZhvzPycxNyklUSFRJ8kqWj0vv0ghLzEvRaEiT11HHc6BsKHisdGJ2kmx2kAR9f8FRZl5JRppGgY6CgaamlxIXEMkriGqrCFY9j8A "Python 3 – Try It Online")
[Answer]
# [Factor](https://factorcode.org/), 55 bytes
```
[ + { "NOR NAND XNOR""OR NAND XOR""OR AND XNOR" } nth ]
```
[Try it online!](https://tio.run/##PY7BCsIwEETv@Yoh4MmL7VFREATxEkERhNJDSBMN1rQm6UFKvz0utZRdmHnMMqyRKjY@3a4ncVzjpb3TNWyDt4xPBP3ptFM6QHovvwGm8RRE6x7YMNajx4pmGDUbNZs4G3lgrICxPsQcedW14IsKtNsdOFpvXTSpwJLuuThfIPbigDs5zmeaYE6o1dFrZVKyrv8dKKGleqYf "Factor – Try It Online")
Add and index into list of strings.
This one's pretty boring, so here's a longer but more interesting version:
# [Factor](https://factorcode.org/), 73 bytes
```
[ [ or ] [ and ] [ xor ] 2tri [ "" "N"? ] tri@ "%sOR %sAND X%sOR"printf ]
```
[Try it online!](https://tio.run/##LYzLCsIwEEX3/YpLoD/QpeILBHFTQRGE0kWIiQZrWidTUEq/PaZRZuDMuQzXSMUthfNpX@5meGhyuoFt4fWr105pD0kkPx6mpadktu6GeZYNGGDijImcyH/n5GOWVTCWPBcorn0HkfeIu1hCoCPr2IQKFVpCHSHdNfGdvGCyUYSAKMUqBtHXscEfjsj9ptziMt3i14M6KNk003sK4r@W6h6@ "Factor – Try It Online")
My first submission in Factor! Hopefully the first of many, since this language is really cool. Technically this doesn't run on new versions of the language because I didn't put spaces after some strings, but it works on the old version TIO has. (I would use ATO, but it's offline at the moment.)
Explanation:
`[ ... ]` Quotation (anonymous function) taking two booleans   
`[ or ] [ and ] [ xor ] 2tri` Apply each of the three quotations `or`, `and`, `xor` on the two booleans   
`[ "" "N"? ] tri@` Apply to each of the three results: If true, "", else "N"   
`"%sOR %sAND X%sOR"printf` Insert each "" or "N" into the right part of the string, and print.
[Answer]
# [Io](http://iolanguage.org/), 65 bytes
Port of Surculose Sputum's Python answer.
```
method(a,b,"NOR "slice(a|b).."NAND X"slice(a&b).."NOR"slice(a^b))
```
[Try it online!](https://tio.run/##y8z/n6ZgZasQ8z83tSQjP0UjUSdJR8nPP0hBqTgnMzlVI7EmSVNPT8nP0c9FIQImpgYR8w@CCcQlaWr@T9Mw0DHQVCgoyswrycnjAnENkbmGqLKGSLL/AQ "Io – Try It Online")
[Answer]
# [Charcoal](https://github.com/somebody1234/Charcoal), 160 bytes
```
×N¬ΣθOR ×N‹Σθ²AND X×N↔⊖ΣθOR
```
[Try it online!](https://tio.run/##S85ILErOT8z5/z@gKDOvRCMkMze1WEPJT0lHwS@/RCO4NFejUBMIrLkg8kr@QQpKcB6Sap/U4mKoch0FI2Qdjn4uChFY9TgmFefnlJakarikJhel5qbmlaSmIKxEthOo/f9/A4P/umU5AA "Charcoal – Try It Online") Link is to verbose version of code. Takes input as an array or string of two bits. Explanation: Just interpolates the `N`s as appropriate based on the count of `1` bits (zero for the first `N`, less than 2 for the second, and absolute difference from 1 for the third).
[Answer]
# Haskell, 78 Bytes
```
a?b=[h(a||b)"OR""NOR",h(a&&b)"AND""NAND",h(a/=b)"XOR""XNOR"];h x a b|x=a|9>0=b
```
]