Functionable

From Esolang
Jump to navigation Jump to search

Functionable is an incomplete esolang made by User:PKMN Trainer.

Syntax

Most commands are written as functions

[COMMAND_NAME]([OPERAND1],[OPERAND2],[OPERAND3...])

Non-existent functions are ignored. Built-in functions exist, which are:

Caption text
Function Psuedocode Notes
add(a,b) return a + b
neg(a) return -a
gt(a,b) return a > 0
lt(a,b) return a < 0
eq(a,b) return a == 0
jump(a) jump to line a
input(a) if a = 0 then return num_input else return char_input_as_num
not(a) return !a
and(a,b) return a && b
or(a,b) return a || b
if(a,b,c) if a then b else c Can span multiple lines
output(a,b) output a if b = 0 else output char(a)
let(a,b) let a = b
define(a,b0,b1,b2...c) def a(b0,b1,b2...): c Variable amount of inputs. Must have atleast 3 inputs. Can span multiple lines
halt() halt The only built-in function to have no inputs

Programs

Cat

let(a,input(1))
let(b,eq(a,0))
if(
  b,
  halt(),
  output(a,1)
  jump(0)
)