!or

From Esolang
Jump to navigation Jump to search
The title of this article is not correct because of technical limitations. The correct title is actually !|.

!| is a esolang created by Lon233bcc (talk) 20:44, 20 August 2022 (UTC)

(it's called not or because the original language the only commands were not / or boolean logic.

But I've changed it to include & !& ^ !^ !| commands as well.

The idea for this language came to me when I tried to make a full adder using not and or commands in lua

Input/Output Commands:

Command Description
_
Put in front of any input command to take multiple chars/digits/bits of input (until the user presses enter)
~
Get's one bit of input
#
Gets one digit of input as a list of bits (note: when putting a _ before it, each digit will NOT have it's own list, it will be one list of bits to represent the entire number)
$
Gets one character of ascii input as a list of containing a list that represents the ascii value in binary
`
Outputs one bit of output
.
Outputs a integer
,
Outputs a ascii character one 8 bits are put into it. Calling it with no bits in it will output a newline by defualt, clear it with %,

If A or B is a list, it will preform the operation on every bit of A and B. (Assuming A/B is a list of bits and not a list of lists), if either one is shorter, it will assume bits that don't exist are 0 will only return 1 ALL bits return that value

Precede a logic command with a ! to output the opposite of what that command normally does

Putting any logical Operator after a list with no B argument will perform that operation on the entire list at once with and produce a 1 or 0 such a (A!^B)& will output a 1 only if A is equal to B

Logic Commands:

Command Description
!A
Will preform logical NOT on A
A&B
Will preform logical AND on A and B
A|B
Will preform logical OR on A and B
A^B
Will preform logical XOR on A and B
()
Expressions in parentheses are done first.


Loops:

Command Description
[]
Infinite loop
A[]
Loop while A is 1 (Obviously doesn't work if A is a list)
[]B
Loop while B is 0 (Obviously doesn't work if B is a list)
A[]B
Loop while A is 1 and B is 0 (Obviously doesn't work if A or B is a list)
A->i[]
Loop the length of List A times with i as the iterator variable. If there is already a variable called i it will double as the starting value. be sure to clear i after the loop by doing %i
?()
Break out of the current loop if the expression in () is 1, will preform A& if supplied with multiple bits
?!()
Break out of the current loop if the expression in () is 0, will preform A& if supplied with multiple bits

List Compression:

{0x3} is the same as {0 0 0}

{(1 0)x2} is the same as {1 0 1 0}

{{1}x2} is the same as {{1}{1}} You can put multiple {} in parentheses to do the same thing as {(1 0)x2} does but with {}

This can make strings slightly less big.

Lists start indexing at 1 instead of 0 because I hate you.

List Commands:

Command Description
A{}
Will set A to a empty list
*A
Returns the length of A as a binary number.
A=B
Append the shorter list with 0's until both lists have equal length
A>B
Append the last value of A onto B then destroy the last value of A
B<A
Prepend the first value of A onto B then destroy the first value of A
A:B
Append B to A
&A
Output a 1 if all the bits in A are 1
|A
Output a 1 if any of the bits in A are 1
!^A
Output a 1 if all the bits in A are the same
{1 0}.{1 0}
Will return the second item of list {1 0} (so 0) doing {1 0}.2 can also be used

Variable COMMANDS:

Command Description
A
Will set A to 0
A 1
Will set A to 1
%A
Will destroy A (if done on list it will only destroy the contents of the list, unless it's empty)
A>B
Move the value of A into B then destroy A

FUNCTIONS: (functions are secretly magical shapeshifting lists.)

Command Description
+[A B][CODE]
Makes function called + with paramenters A and B

can be run by doing A + B (assuming you only want the first value returned) (And there is only two or less paramenters)

R: Value
Adds to the return list (what the function list will turn into)
->+
Shapeshifts (calls) the function
{A B}->+
Shapeshift (call) function called + with paramenters set to A and B
A>+
Move the value of A into + (TIP: if for some reason you want to use > and not : to move values into functions putting it in {} (like {A}>+ won't destroy A, but it would make more sense to just use :)
%+
Clear the function called + to be ran again
END or \
END the function early.

Code stuff:

// Printing text (Prints whatever is in Str then a newline) (remove the last , to remove the newline)
Str->i[,:Str.i%,]%i%,,
// If statement (runs Code if A=B)
{1}->[?(A^B) // Code]

Truth Machine

~[`1]`0


Cat Program:

[$,%,]



Characters that are not accepted in variable names: (anything else is accepted) ~!@#$%^&*()`=_[]{}|\/><.,:OR SPACE TAB NEWLINE