5-logic

Description
+---+   Adjacent  Opposite |      | !    @%        #$ |   !   | @    #!        $% | %   @ | #    $@        %! |  $ #  | $    %#        !@ |       | %    !$        @# +---+

A value can be:
 * 5-value: one of ! @ # $ %
 * List: list of zero or more values inside square brackets. For example: [![Zero@@]{2_0_Take}]
 * Variable name: Name of a variable, first letter uppercase rest lowercase (only letters).
 * Program code: A program code with curly brackets. Use semicolons to separate commands. Example: {A=!;B=%;2AB}

Commands:
 * value - Return this value from this function
 * var=value - Set a value of a variable
 * \name - External system function
 * /*comment*/ - Comment
 * -var - Makes a new variable local to this block of program code and sub-calls
 * --</tt>var - Same as above but initial value is argument of this function-call.
 * value:</tt>code - For each element in list(value), execute code, element is argument, return value exits loop and returns from parent code. (Error if value is not a list or the name of a variable containing a list)
 * ?</tt>value - Return this value from the function if previous line changed a value of a variable to a 5-value adjacent to its previous value. (Error if either value isn't a 5-value. Even error if new or old value is a variable name.)

Operators:
 * 2</tt>xy - 2-logic on values. 2-logic on adjacent values = common opposite value. 2-logic on opposite values = common adjacent value. 2-logic on 2 same values = value.
 * 3</tt>xyz - 3-logic on values. 3-logic on xyz = (x if x=2yz, y if y=2xz, z if z=2xy). 3-logic on xxy = y. 3-logic on xxx = x.
 * `</tt>xy - Apply function x to argument y.
 * +</tt>xy - Concatenate 2 lists.
 * ^</tt>x - Include contents of a list inline. Example: 2^[!%]</tt> --> 2!%</tt> --> #</tt> and [!2^[###]!]</tt> --> [!2###!]</tt> --> [!##!]</tt>
 * 0</tt> - Uses argument of this function.
 * 1</tt> - Uses argument of parent function.

When evaluating parameters to 2 or 3, convert variable names to their values. If one or more parameters is a list, they must all be of the same length, then iterates through list in order using non-lists as well. For example: <tt>2[ab]c = 2[ab][cc]</tt> and <tt>3!@]$][%[$%</tt> --> <tt>3!%%3@%%][3$%</tt> --> <tt>!@][%</tt> (If variables are undefined or lists of not matching size, or are program codes, then is error.)

For ^ and + commands, variable names are converted to values of variabled. Errors if 5-value or program-codes or undefined variabled.

For ` command, the function x is converted to its value if is a variable name. If x is a 5-value or a list or undefined variable, then is error.

Examples
If you want to use binary functions, and you use !=1 and @=0 then you can do: NOT x = 22x$$ x XOR y = 3xy@ x AND y = 2!`{320$20@0}2$2xy x OR y = 2@`{320$20!0}2$2xy For example: Not={220$$}; A=`NotB;