YAML

From Esolang
Jump to navigation Jump to search
Not to be confused with wikipedia:YAML.

YAML (yet another modulo language) is another modulo language created by user:cleverxia inspired by AML.

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%g(a)
    set i to q%g(i)

a bit more complex, 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 g x_0 x_1 x_2 ... where f is in javascript lambda format, and takes input in the initial accumulator

False machine

x=>x x=>99999999 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}
function g(n){return 999999999999n}

a=i=0n;while(1){if(!x(i))process.exit();oa=a;a=f(oa)%x(i)%g(oa);i=f(oa)/x(i)%g(i)}

computational class

I don't know. but at least if the infinite sequence x(i) is uncomputable then this language isn't, too.