Variambda

From Esolang
Jump to navigation Jump to search

This is another esolang by islptng.

The title, is a mixture of "Variable" and "lambda".
The only thing you can do in this esolang is define a variambda.

Syntax

Line to define a variambda:

name(arguments)return_value=initial_value

if (arguments) return_value is not present, it acts as a constant.
if =initial_value is not present, it will be zero when initialized. Lists are also supported:

name[index](arguments)return_value=initial_value

How to call a variambda:

name # returns its value in the variable part
name(arguments) # returns its result in lambda part and set its variable part to the returned value

Variambdas that is already defined, initializes as 0:

in_num()   : gets a number from stdin
in_chr()   : gets a character from stdin and return its ASCII value
out_num(n) : prints n in number and returns n
out_chr(n) : prints n in character (ASCII) and returns n
sub(a,b)   : return a - b
what(a,b)  : if a > 0, return b, else return a
sum(args)  : returns the sum of args

Define a variambda called "fuck": when program starts, it will execute fuck().

Every program without definition of "fuck()" does nothing.

Examples

Infinite loop:

fuck()fuck()=0

Truth machine:

const49 = 49
repeat1()sum(out_chr(const49),repeat1())
fuck()out_chr(what(in_num(),repeat1()))

A+B problem:

fuck()out_num(sum(in_num(),in_num()))