Jelly, 2 bytes
NC
Try it online! Or see all test-cases.
How?
In Jelly any sequence of monadic atoms forms a monadic chain which simply applies those monadic atoms in turn from left to right, starting with the value of it's left argument. When a full program is run with no arguments zeros are implicitly supplied as necessary, i.e. main_link(0) is called. As such NC is C(N(0)) and CN is N(C(0)).
NCNC ... CN ... NC - Main Link: no arguments
N - negate((implicit)0) -1 * 0 = 0
C - complement(that) 1 - 0 = 1
N - negate(that) -1 * 1 = -1
C - complement(that) 1 - -1 = 2
... -
... - ... = x a
C - complement(a) 1 - a = 1 - a
x N - negate(that) -1 * (1 - a) = a - 1 ... - x
... - ... = b
N - negate(b) -1 * b = -b
C - complement(that) 1 - x)-b = x -b + 1
Jelly, 2 bytes
NC
Try it online! Or see all test-cases.
How?
In Jelly any sequence of monadic atoms forms a monadic chain which simply applies those monadic atoms in turn from left to right, starting with the value of it's left argument. When a full program is run with no arguments zeros are implicitly supplied as necessary, i.e. main_link(0) is called. As such NC is C(N(0)) and CN is N(C(0)).
NCNC ... CN - Main Link: no arguments
N - negate((implicit)0) -1 * 0 = 0
C - complement(that) 1 - 0 = 1
N - negate(that) -1 * 1 = -1
C - complement(that) 1 - -1 = 2
... -
... - ... = x
C - complement 1 - x = 1 - x
N - negate -1 * (1 - x) = x - 1
Jelly, 2 bytes
NC
Try it online! Or see all test-cases.
How?
In Jelly any sequence of monadic atoms forms a monadic chain which simply applies those monadic atoms in turn from left to right, starting with the value of it's left argument. When a full program is run with no arguments zeros are implicitly supplied as necessary, i.e. main_link(0) is called. As such NC is C(N(0)) and CN is N(C(0)).
NCNC ... CN ... NC - Main Link: no arguments
N - negate((implicit)0) -1 * 0 = 0
C - complement(that) 1 - 0 = 1
N - negate(that) -1 * 1 = -1
C - complement(that) 1 - -1 = 2
... -
... - ... = a
C - complement(a) 1 - a = 1 - a
N - negate(that) -1 * (1 - a) = a - 1 ... -
... - ... = b
N - negate(b) -1 * b = -b
C - complement(that) 1 - -b = b + 1
Jelly, 2 bytes
NC
Try it online! Or see all test-cases.
How?
In Jelly any sequence of monadic atoms forms a monadic chain which simply applies those monadic atoms in turn from left to right, starting with the value of it's left argument. When a full program is run with no arguments zeros are implicitly supplied as necessary, i.e. main_link(0) is called. As such NC is C(N(0)) and CN is N(C(0)).
NCNC ... CN - Main Link: no arguments
N - negate((implicit)0) -1 * 0 = 0
C - complement(that) 1 - 0 = 1
N - negate(that) -1 * 1 = -1
C - complement(that) 1 - -1 = 2
... -
... - ... = x
C - complement 1 - x = 1 - x
N - negate -1 * (1 - x) = x - 1
Jelly, 2 bytes
NC
Try it online! Or see all test-cases.
How?
In Jelly any sequence of monadic atoms forms a monadic chain which simply applies those monadic atoms in turn from left to right, starting with the value of it's left argument. When a full program is run with no arguments zeros are implicitly supplied as necessary, i.e. main_link(0) is called. As such NC is C(N(0)) and CN is N(C(0)).
NCNC ... CN - Main Link: no arguments
N - negate((implicit)0) -1 * 0 = 0
C - complement(that) 1 - 0 = 1
N - negate(that) -1 * 1 = -1
C - complement(that) 1 - -1 = 2
... -
... - ... = x
C - complement 1 - x = 1 - x
N - negate -1 * (1 - x) = x - 1