Th

From Esolang
Jump to navigation Jump to search

Th is an esoteric programming language consisting of one named pair of values, created by User:Scan in 2008. A value is again either a named pair or an atom. Is it similar to Lisp, but the length of a list is fixed. Thus, a pair represents an atomisable value itself, meaning a pair is just a thing to be evaluated. Eventually, a Th program is pretty simple.

Types

Th is not type-safe. Every atom is seen as an atom. The programmer is supposed to watch what they're typing.

Predefined pairs

Pair name Description
+(,) Arithmetic addition
*(,) Multiplication
-(,) Subtraction
/(,) Division
print(,) Prints the values
read(,) Evaluates to an atom read from the keyboard, prints left before and right after input
let(x,v) Defines x as a constant that has the given value in the containing pair

More to come (I appreciate suggestions).

Examples

Hello, world!

print("Hello, ", "World!")

This is equivalent to:

print("Hello, World!", nil)

Addition

print("a + b = ", +(read("a = ", "\n"), read("b = ", "\n")))