We are currently working on new rules for what content should and shouldn't be allowed on this website, and are looking for feedback! See Esolang:2026 topicality proposal to view and give feedback on the current draft.

Quick cryptid generator

From Esolang
Jump to navigation Jump to search

Quick cryptid generator or QCG for short is an esolang that defines a recursive function

Definition

start with a number at the top of your code this is the number of inputs $ will have (#i is a free variable) you use recursion like this:

$(expr_1(#1),expr_2(#2),...,expr_n(#n)) = $(f_1(#1,#2,...,#n),f_2(#1,#2,...,#n),f_n(#1,#2,...,#n))

(no expr_i(x) or f_i(...) may use $) and base cases:

$(expr_1(#1),expr_2(#2),...,expr(#n)) = f(#1,#2,...,#n)

(no expr_i(x) or f(...) can use $) you can use +, -, *, () and any natural number (@ means user input)

$(x_1,x_2,...,x_n)

means evaluate $(x_1,x_2,...,x_n) and print the result

example:

2
$(2*#1,#2) = $(#1,#2+1)
$(2*#1+1,#2) = $(3*#1+2,#2+1)
$(0,#2) = #2
$(@,0)

returns https://oeis.org/search?q=0%2C1%2C7%2C2%2C5%2C8&language=english&go=Search (input)

Programs

not a

1
$(0) = 1
$(1) = 0
$(@)

a or b

2
$(0,0) = 0
$(1,0) = 1
$(0,1) = 1
$(1,1) = 1
$(@,@)

a and b

2
$(0,0) = 0
$(1,0) = 0
$(0,1) = 0
$(1,1) = 1
$(@,@)

a+b

2
$(#1,#2) = #1+#2
$(@,@)

a*b

2
$(#1,#2) = #1*#2
$(@,@)

a^b

3
$(#1,#2,#3) = $(#1,#2-1,#3*#1)
$(#1,0,#3) = #3
$(@,@,1)

a!

2
$(#1,#2) = $(#1-1,#2*#1)
$(0,#2) = #2
$(@,1)