nyuuzyou/wikis huggingface dataset:
Treehugger/Implementation

module Main where
 
 import Prelude hiding (zip)
 import Data.Char
 import Data.Maybe
 import Control.Monad.IO.Class
 import Control.Monad.Trans.Maybe
 import Text.ParserCombinators.ReadP
 
 ---------------------------------------------------------------------------
 
 data T a = B (T a) a (T a)
 
 data Z a = ZL (Z a) a (T a)
 | M (T a) (T a)
 | ZR (T a) a (Z a)
 
 zero = B zero (0 :: Int) zero
 
 zip (B l x r) = (x, M l r)
 
 plug x (ZL zl y r) = B (plug x zl) y r
 plug x (M l r) = B l x r
 plug x (ZR l y zr) = B l y (plug x zr)
 
 left v (ZL zl x r) = case left v zl of (y, zl') -> (y, ZL zl' x r)
 left v (M l r) = case zip l of (y, zl) -> (y, ZL zl v r)
 left v (ZR l y zr) = case left v zr of (y, zr') -> (y, ZR l y zr')
 
 right v (ZL zl x r) = case right v zl of (y, zl') -> (y, ZL zl' x r)
 right v (M l r) = case zip r of (y, zr) -> (y, ZR l v zr)
 right v (ZR l x zr) = case right v zr of (y, zr') -> (y, ZR l x zr')
 
 back v (ZL (M l' r') x r) = let t = plug v (M l' r') in return (x, M t r)
 back v (ZL zl x r) = do (e, zl') <- back v zl ; return $ (e, ZL zl' x r)
 back v (M l r) = Nothing
 back v (ZR l x (M l' r')) = let t = plug v (M l' r') in return (x, M l t)
 back v (ZR l x zr) = do (e, zr') <- back v zr ; return $ (e, ZR l x zr')
 
 ---------------------------------------------------------------------------
 
 data TH = INC | DEC
 | BCK | LFT | RHT
 | REP [TH]
 | DOT
 deriving Show
 
 exec' :: (Int, Z Int) -> [TH] -> MaybeT IO (Int, Z Int)
 exec' s [] = return s
 exec' s (i:is) = do s' <- exec s i ; exec' s' is
 
 exec :: (Int, Z Int) -> TH -> MaybeT IO (Int, Z Int)
 exec (v,z) INC = return (v+1,z)
 exec (v,z) DEC = return (v-1,z)
 exec (v,z) BCK = MaybeT . return $ back v z
 exec (v,z) LFT = return (left v z)
 exec (v,z) RHT = return (right v z)
 exec (0,z) (REP insts) = return (0,z)
 exec (v,z) (REP insts) = do s' <- exec' (v,z) insts ; exec s' (REP insts)
 exec (v,z) DOT = do liftIO (putStr [chr v]) ; return (v,z)
 
 ---------------------------------------------------------------------------
 
 th code = do runMaybeT (exec' (zip zero) code) ; putStrLn ""
 
 ---------------------------------------------------------------------------
 
 pTH = choice [ do char '+' ; return INC
 , do char '-' ; return DEC
 , do char '^' ; return BCK
 , do char '<' ; return LFT
 , do char '>' ; return RHT
 , do char '[' ; pRep
 , do char '.' ; return DOT
 ]
 pRep = do th <- many pTH ; char ']' ; return (REP th)
 
 parse text = case readP_to_S (do r <- many pTH ; eof ; return r) text of
 [(code,"")] -> Just code
 _ -> Nothing
 
 ---------------------------------------------------------------------------
 
 main = do
 input <- getContents
 let code = filter (`elem`"+-^<>[].") . takeWhile (/='#') $ input
 case parse code of
 Nothing -> print ("Error in: " ++ input)
 Just program -> th program
Category:Implementations
Treeng

A treeng is an esoteric data structure that is produced when you mix a tape ring (a tape that is joined at the ends) with a tree. There's a root node, which has child nodes, which have child nodes, et cetera, then all leaves loop back to the root node. Only one node can point to any given node, unlike directed graphs. Treengs may be resizable if you can insert a node between the immediate connection of a leaf and the root node.
Category:Data Types and Structures
Treescript

Treescript is a language created by User:TJC games. It is an unholy combination of JavaScript, Python, and Lua, made for an incredibly niche modding API for a random idle game made by an 8-year-old somewhere.
== Basic information ==
In treescript, most things are methods, variables, or functions. Methods are used with
 method args:
 contents
. Variables are assigned with standard JSON definitions, but Break_Eternity.js is prioritised over standard JS numbers.
== Step-by-step creation ==
=== Base layer ===
Every tree needs layers, defined with the layer macro:
 layer p:
 format:
 symbol: P
 colour: #38ac34
 position: 0,0
 data:
 layerShown: () return true
 pointName: prestige points
 name: prestige
 prestige:
 type: normal
 requires: 10
 exponent: 0.5
 saved:
 points: 0
 hotkeys:
 p:
 description: P: Reset for prestige points
 function: () if canReset p then doReset p
Everything here expect hotkeys and prestige is required. If prestige is missing, it assumes that you cannot reset on this layer.
Category:Languages
TriINTERCAL

TriINTERCAL is an esoteric programming language created by Louis Howell in 1991 as a more difficult version of INTERCAL. It uses ternary instead of binary, and introduces the logical BUT operation.
TriINTERCAL programs are distinguished from INTERCAL programs by the filename extension; .3i (as opposed to .i). There is often no other way to tell them apart, because BUT and sharkfin aren't really that useful and so are not often used, and INTERCAL programs don't necessarily specify constants above 59048.
==Ternary logic==
TriINTERCAL differs from INTERCAL only in the width of the data types (one-spot data types are 10 trits wide and two-spot data types are 20 trits wide), and in the operators available in expressions. AND and OR are generalizations of the INTERCAL binary versions, BUT is new, and sharkfin and what are two different interpretations of XOR (both of which are available in TriINTERCAL). Mingle mingles trits, rather than bits, whereas select ANDs the two original numbers, then sorts all the bits in the first number corresponding to 2s in the second number to the least significant end, 0s in the second number to the most significant end, and 1s in between them.
AND, OR, mingle, and select operate just like their binary counterparts if no trits with the value 2 are present.
===AND===
&	0	1	2
0 	0	0	0
1 	0	1	2
2 	0	2	2
===OR===
V	0	1	2
0	0	1	2
1	1	1	2
2	2	2	2
===BUT===
@	0	1	2
0	0	1	0
1	1	1	1
2	0	1	2
===Sharkfin===
^	0	1	2
0	0	1	2
1	1	2	0
2	2	0	1
===What===
?	0	1	2
0	0	1	2
1	2	0	1
2	1	2	0
==Examples==
The following program is valid INTERCAL and TriINTERCAL; it outputs II if compiled as INTERCAL and III if compiled as TriINTERCAL.
 DO .1 <- #1 $ #0
 DO READ OUT .1
 PLEASE GIVE UP
(This program is right on the boundary as far as politeness is concerned; any more polite and it would be too polite.)
The following program reads in (or WRITES IN) a twospot number, and then outputs the result of applying all 5 ternary logical operations to it:
 DO WRITE IN :1
 DO :2 <- :&1
 PLEASE READ OUT :2
 DO :2 <- :V1
 PLEASE READ OUT :2
 DO :2 <- :@1
 DO READ OUT :2
 DO :2 <- :^1
 DO READ OUT :2
 DO :2 <- :?1
 DO READ OUT :2
 PLEASE GIVE UP
When given the input ONE TWO THREE FOUR FIVE SIX SEVEN, this program gives the following output:
 _ 
 LMMDCCCLVII
 __________ 
 mclxMMMDCCCLIVDCCVIII
 _______ 
 mclxMMCCCXVXLV
 _____________ 
 mclxMMMDCCCXXVIIIDCCXCVII
 ______ 
 mclxMMMCCXMMCIX
(This sort of thing explains why a wimpmode option was added to some INTERCAL compilers; the same wimpmode is often present in TriINTERCAL compilers (indeed, they are often the same compilers).)
In wimpmode, the output looks like this (with the input 1234567):
 52857
 1163854708
 1162315045
 1163828797
 1163212109
which, unfortunately, is still unintelligible in decimal. So in ternary:
 3r00000000002200111200
 3r10000002222221111221
 3r10000000002201111101
 3r10000002221121222021
 3r10000001210022000222
(here, the input is the same value, now written 3r00000002022201111201.)
==External resources==
* The original Usenet post
Also see External INTERCAL resources.
Category:Languages
Category:Implemented
Category:Turing complete
Category:Before 1993
TriTape

TriTape is an esolang by User:Joaozin003 where each cell in the tape stores a trit (base-3 digit).
== Storage ==
As said in the intro, there is a tape (note: infinite only to the right!) that stores one trit in each cell.
There is also an accumulator which stores one trit. This accumulator is independent from the tape, but operations can be performed on the two.
== Instructions ==
Here is a table of instructions:
 I | Meaning
 ^ | Increment the accumulator, wrapping around.
 v | Decrement the accumulator, wrapping around.
 > | Move the tape pointer right.
 < | Move the tape pointer left. If the current cell is the first, instead copy the value of the accumulator into it.
 = | Copy the value of the current cell into the accumulator.
 0 | Zero the current cell out.
 + | Add the value of the accumulator into the current cell, wrapping around. *Table later
 , | Take a trit from input and copy it into the current cell.
 . | Output the current cell's trit.
 [ | Jump past the matching ] if the accumulator is 0.
 ] | Jump back to the matching [.
 { | Jump past the matching } if the accumulator is not 0.
 } | Jump back to the matching {.
Table for the + instruction:
 C012
 A
 0 012
 1 120
 2 201
 
 A stands for accumulator, C stands for current cell.
== Examples ==
=== Truth Machine ===
 ,=[.].
Note: It also outputs "22222222222222222..." if fed a 2.
The following implementation, on the other hand, always prints “1” for a non-zero input:
 ,=[[^]^<.].
=== Cat program ===
This numeric cat program repeats until an input of zero (0) is committed:
 ,=[.,=]
=== Repeated Printing ===
The program below prints the digit one (1) five times using a loop:
 ^<v>>>>>{^+.<v=}
== Turing-completeness ==
A subset of TriTape is equivalent to Boolfuck, described in this table, assuming that no 2s are input:
 BoolFuck | TriTape
 + | =^+
 , | ,
 ; | .
 < | =<
 > | >
 [ | =[
 ] | =]
And because BoolFuck is Turing-complete, TriTape is also Turing-complete.
==Interpreter==
* Common Lisp implementation of the TriTape programming language.
Category:Languages Category:2023 Category:Turing complete Category:Implemented
Triad

triad is a language created by User:Quelklef based heavily off of 3var but with the goal of being cleaner and having a more precise spec. Execution of triad handles only 3 values, called A, B, and R, all of which are unbounded integers. Code consists of two-character instructions. Each instruction is designed to be mnemonic signifying what it does. Typically, the first character represents the "source" of some data and the second character represents the "destination" of some data.
== Instructions ==
 Value Manipulation
 
 +a [A <- A + 1] Increments A
 +b [B <- B + 1] Increments B
 -a [A <- A - 1] Decrements A
 -b [B <- B - 1] Decrements B
 +r [R <- A + B] Sets R to the sum of A and B
 -r [R <- A - B] Sets R to the difference of A and B
 *r [R <- A * B] Sets R to the product of A and B
 /r [R <- A div B] Sets R to the quotient of A and B. Precisely, this is floor(A / B), where '/' is mathematical division, not floating-point division.
 %r [R <- A mod B] Sets R to the modulus of A and B. Precisely, this is A - B * (A div B).
 ^r [R <- A pow B] Sets R to the result of raising A to the Bth power
 ar [R <- A] Sets R to A
 br [R <- B] Sets R to B
 ra [A <- R] Sets A to R
 rb [B <- R] Sets B to R
 0a [A <- 0] Sets A to 0
 0b [A <- 0] Sets B to 0
 0r [R <- 0] Sets R to 0
 
 Input & Output
 
 rO Prints R. Note that that is the letter 'O', not zero '0'. (Mnemonic: "R Out")
 rA Prints the ascii value associated with R, treating R as modulo 128. (Mnemonic: "R Ascii")
 Nr Reads a number as input and stores it into R. The number must match the regex [0-9]*. If there is no matching number, stores 0. (Mnemonic: "Number R")
 Ar Reads one character input and stores its Ascii value into R. If there are no characters left, stores 0. (Mnemonic: "Ascii R")
 
 Control Flow
 
 >[ Begins a conditional that executes only if A > B
 <[ Begins a conditional that executes only if A < B
 =[ Begins a conditional that executes only if A = B
 ]. Ends a conditional
 
 >{ Begins a loop that executes while A > B
 <{ Begins a loop that executes while A < B
 ={ Begins a loop that executes while A = B
 1{ Begins a loop that executes forever
 a{ Begins a loop that executes A times
 b{ Begins a loop that executes B times
 }. Ends a loop
 
 Comments
 
 (( Begins a comment
 )) Ends a comment
== Example Programs ==
Cat:
 +b (( let B=1 ))
 <{ (( while A<B, aka while B>0, ))
 Ar rb rA (( input then output an ascii char and store it in B ))
 }.
Truth Machine:
 Nr rb (( input a number into R and B ))
 +a (( let A=1 ))
 =[ 1{ rO }. ]. (( if A=B, aka if B=1, infinitely output R=B=1 ))
 0r rO (( otherwise, let R=0 and output R ))
== Implementations ==
A triad implementation is built-in to esoglot. It is written in Haskell.
Triangular numbers

Triangular numbers are numbers that are the counts of objects arranged in an equilateral triangle. It can be calculated by computing n(n+1)/2 or 1 + 2 + ... + n. The sequence is as such:
 0, 1, 3, 6, 10, 15, 21, 28, 36, 45, 55, 66, 78, 91, 105...
Visualized, that is (starting from 1):
 +0 = 0
 o +1 = 1
 o o +2 = 3
 o o o +3 = 6
 o o o o +4 = 10
 o o o o o +5 = 15
o o o o o o +6 = 21 = 6(6+1)/2
 = 6(7 )/2
 = 42 /2
 = 21
== Implementations ==
===AEL===
 40?0 0 2d[$1+!+!]m#
===Counting===
Outputs in unary.
 when cnt == 0
 read acc
 when cnt <= acc
 out "*" * cnt
 when cnt > acc
 halt
 
 % 1 + 2 + ... + acc
===DeBruijn===
Uses the fixed-point "Y" combinator to recursively find the sum of the first n naturals. The definition of f is used as example input.
(F \\0 )
(T \\1 )
(S \\\1(210) )
(f S(S(S(S(SF)))) )
(P \\\021 )
(- \0(\(\P(1F)(S(1F)))\0)(PFF)T )
(Z \0(\0FF)T )
(Y \(\1(00))[\1(00)] )
Y\\Z0[F][1(-0)S0]
> debruijn example.txt f
rem: λ λ 1 (1 (1 (1 (1 (1 (1 (1 (1 (1 (1 (1 (1 (1 (1 0))))))))))))))
===Iterate===
(*)∞<
 *n<
 *~n<
 (1*)<>
 >
 !
 >
 (4*)1<
 (2*)=1<
 *~n< &2 >
 @
 !4
 >
 (3*)48<
 *~n< &3 >
 ~@
 >
 >
 (5*)10<
 *~n< &5 >
 ~@
 >
>
===Swordfish===
 1~[0,,,,,v
 ]+#~500$%\
 1]+~[@,,,\
Category:Program forms
Trickcode

==Trickcode==
Trickcode is a language made by User:Trickbrain26 and modeled, a little after brainf**k, and mostly after 3var
It has 40 commands but is quite easy to use, It is a simple language to use because as all its commands are 1 character
It has 100 cells(0-99) for memory, and it has some extra variables for calculations like var1, var2, return, clipboard
==Commands==
Command	Description
< 	Decrement the cell pointer
> 	Increment the cell pointer
^ 	Print the ASCII of the cell pointer
% 	Print the value of the cell pointer
+ 	Increment the current cell
- 	Decrement the current cell
c 	Copy the current cell to the clipboard
v 	Paste the clipboard into the current cell
/ 	Set the current cell as var1
\ 	Set the current cell as var2
_ 	Set the current cell to the return value
a 	Add var1 to var2 and store in return
s 	Subtract var2 from var1 and store in return
m 	Multiply var1 by var2 and store in return
d 	Divide var1 by var2 and store in return
M 	Mod var1 by var2 and store in return
e 	Exponentiate var1 by var2 and store in return
u 	A forever statement (for use with "while loops")
x 	A statement var1==var2 (for "if statements" and "while loops")
y 	A statement var1>var2 (for "if statements" and "while loops")
z 	A statement var1<var2
i 	A statement of var1 (for "for loops")
l 	A statement of var2 (for "for loops")
p 	Print the ASCII of the current cell, or if a newline character is input then make a new line
P 	Print the value of the current cell
{ 	Start an if statement, must have a statement before it
} 	End an if statement
[ 	Start a while loop, must have a statement before it
] 	End a while loop
r 	Reset the current cell
R 	Reset all the cells
# 	Take a number input and store it to the current cell
" 	Take a 1 character input and store the value of it to the current cell
$ 	Start a line comment
& 	End a line comment
( 	Start a for loop, must have a statement before it
) 	End a for loop, must have a statement before it
` 	Tells the interpreter to ignore the next character
! 	Terminate the program
w 	Wait 1 frame
Only these commands are processed by an interpreter other characters such as spaces, etc. are not
==Sample Programs==
Here are some sample programs i made
=====Hello World!=====
 +++++++/+++\m_++>++++++++++/\m_+c>v+++++++c>v>v+++>+++/+++++++\m_++>+++++++/++\m_+++++++
 >++++++++++/\m_+++++++++++c>v+++>v---c>v-------->+++/++++++++\m_<<<<<<<<<<p>p>p>p>p>p>p>p>p>p>p
=====Countdown=====
 >+++++++++++++<-\+++++++++++/y[P>p<-/wwwwwww]
=====Cat=====
 u["p]
==Links==
brainf**k
3var
An Compiler for Smilebasictm: Compiler
Trigational Pseudoomninumitype

Trigational Pseudoomninumitype /traɪ.geɪ.ʃə.nl̩ suː.do.ɔm.niː.njuːm.ɪ.taɪp/ is an esoteric programming language created by User:CreeperBomb. A more accurate and understandable name might be "Limited Continuous Three-gates", as the program has three logic gates extended to all reals in [0,2). However, the actual name also (technically) describes this, makes User:CreeperBomb sound extremely 
jejune1 (and perhaps even elephant!), and can be used to strike terror into the hearts of innocent readers. There is no valid acronym or abbreviation, meaning the full name must be used when mentioning it. Make sure to not make a tyop!
Trigational Pseudoomninumitype is believed to be Turing-complete.
==Gates==
As stated, there are three gates that can be used: N, +, and &.
# N (read as "not" /nɒt/) takes one input and outputs 1 minus the input.
# + (read as "xor" /ksor/) takes two inputs and outputs their sum.
# & (read as "and" /ænd/) takes two inputs and outputs their product.
The mod(2) of these are then taken to preserve the [0,2) property.
==Node definitions & basics==
When writing a node definition in Trigational Pseudoomninumitype, there are 3-4 parts:
# The node name saying what gets set, and is at the beginning
# The operation (N, +, or &)
# The first input
# A comma & the second input (if the operation is not N)
Inputs are names of nodes. In every step of the program, the node will get the value determined by this. All nodes start with a value of 0, and undefined nodes will always be 0, with the exception of fractions. Any node of the form a÷b, where a and b are integers and 0≤a÷b<2 starts with a value of a÷b instead of 0. Node can't have "N", "&", "+", ",", or a newline in their name. Otherwise, whitespace and capitalisation is ignored.
==Special nodes==
There are three special nodes used for I/O: "input", "output", & "output confirm". "Input" is equal to user input. "Output" stores the contents of any output. "Output confirm" will output the value of "output" when it changes from [0,1) to [1,2) in a step (after "output" has updated its value).
==Visual representation==
Trigational Pseudoomninumitype, in addition to its textual/basic descriptions of programs, also has a visual form, from which the term "node" comes from. In it, nodes are drawn as circles with labels and directed connections based on their operation, inputs, and nodes it outputs to. The gate is written as a single letter in the center of the circle - "N" for "N", "+" for "+", "&" for "&", "I" for "input", "O" for "output", "C" for "output confirm", and "a/b" for "a÷b". The inputs/outputs are drawn as directed arrows coming from the input node to the output node.
==Examples==
Truth machine:
Output & Input, Input
Clock N Clock
Can Ouput & Clock, Input
Output Confirm N Can Output
Or of nodes "A" and "B" into "E":
C + A, B
D & A, B
E + C, D
Category:Languages
Trigger

Trigger is an esoteric programming language designed in 2005 by Keymaker, based on triggers, which are toggled by patterns (rows of the same character). There are four different patterns, thus four instructions. One for toggling triggers, one for conditional jumping, one for output, and one for input.
Trigger has 256 different triggers (one per each ASCII character), making the language have 256 bits of memory to use. Trigger is clearly not Turing-complete.
==Computational class==
Trigger is a bounded-storage machine, since it is limited to 256 bits of storage.
==See also==
* Udage, the language Trigger evolved from. (Before Udage was even completed.)
==External resources==
* Trigger website (features the specs and programs)
Category:Languages
Category:Finite state automata
Category:Low-level
Category:Pattern-based
Category:Implemented
Category:2005
Triple Threat

Triple Threat (hereafter TT) is a stack-based esolang. Every command modifies and juggles the numbers in one or two of three stacks. Each stack is capable of different actions, so juggling values around the circle is critical to getting anything done.
=== Memory ===
TT makes use of three LIFO stacks to handle data. Each stack has an ID number: Stack 1, Stack 2 and Stack 3. At the start of the program, all three stacks are empty. Each stack can hold an arbitrary number of unbounded, signed integers; the only limit on stack depth are those imposed by the hardware used.
=== Commands ===
There are a total of 12 valid commands in TT.
* 11: Push a 0 onto Stack 1.
* 22: Push a 1 onto Stack 2.
* 33: Pop the top number of Stack 3 and discard it.
* 12: Pop the top number of Stack 1 and push it onto Stack 2.
* 23: Pop the top number of Stack 2 and push it onto Stack 3; if Stack 2 is empty, input an integer and push it onto Stack 3.
* 31: Pop the top number of Stack 3 and push two copies of it onto Stack 1.
* 13: Pop the top number of Stack 1 and increase the top number of Stack 3 by the popped number.
* 21: Pop the top number of Stack 2 and decrease the top number of Stack 1 by the popped number.
* 32: Pop the top number of Stack 3 and replace the top number of Stack 2 with the popped number; output the number replaced.
* 10: Pop the top value of Stack 1; if the popped value is 0, skip to after the matching 30.
* 30: Pop the top value of Stack 3; unless the popped value is 0, skip to after the matching 10.
* 00: End the program.
Any number of commands can be on one line; each command on the same line must be separated by a dash (-). Everything after the last command is ignored as a comment as is any line that doesn't start with a command. The program terminates if it reached the end of the file or a "00" command.
10 and 30 create matching pairs, like parentheses. There is no maximum recursion depth except hardware limitations.
=== Handling an empty Stack ===
If a command (other than 23) tries to pop or manipulate a number from an empty stack, it pushes a 0 onto the empty stack before resolving the command.
=== Example Code ===
Cat:
 23-31-12-12-23-32-00
Truth machine:
 23-31
 10-22-22-23-32-23-30
 11-22-23-21-32-00
=== Turing-Completeness ===
Triple Threat can be shown to be Turing-complete by reduction to brainfuck. First, start the program with "11-11-11-11-11-11-11-11-11-11" to create a 10 cell tape; when more cells are needed, the empty stack handling rules will automatically add them. Then, replace each BF command with the following TT commands:
 +: 22-23-13-31-12-23-33
 -: 22-21
 >: 12-23
 <: 31-12-23-33
 ,: 23-12-23-33-31-12-23-33
 .: 12-23-31-12-22-23-32-23-33
 [: 12-23-31-10
 ]: 12-23-31-12-23-30
The top number on Stack 1 is the data pointer. The rest of Stack 1 is to the right of the data pointer and Stack 3 is to the left of the data pointer. Stack 2 is always empty between commands.
=== Interpreter ===
Python interpreter.
Category:LanguagesCategory:2017Category:Turing completeCategory:ImplementedCategory:Stack-based