Another modulo language
Jump to navigation
Jump to search
Another modulo language is another modulo language created by user:cleverxia inspired by the collatz functions.
program flow
program consists of two function f and g and infinite numbers xi. when the program starts, the interpreter does the following:
- set i,a to 0
- repeat forever:
- if xi is 0:
- halt the program
- otherwise:
- divide f(a) by xi, let quotient be q, remainder be r
- set a to r
- set i to q
- if xi is 0:
very simple, isn't it?
if you want an output extension, you can define x%-1=0, x/-1=x, and x%-1 also outputs x as a character.
examples
from now on, programs use this format: f x_0 x_1 x_2 ... where f is in javascript lambda format, and takes input in the initial accumulator
False machine
x=>x 1 0 0 0 0...
interpreter
//note: x_i is provided as a function here, to avoid coding infinite numbers
function x(i){return i==0n?1n:0n}
function f(n){return n}
a=i=0n;while(1){if(!x(i))process.exit();oa=a;a=f(oa)%x(i);i=f(oa)/x(i)}
computational class
I don't know. but at least if the infinite sequence x(i) is uncomputable then this language isn;t, too.