Hi. I developed an interpreter for a simple language, one or two years ago. Example:
number(x)
succ: x+1
pred: x-1
test: [
number(0).succ == 1,
number(0).pred == -1
]
The first line is short for
number(x): this
It behaves like the following JS code:
function() {
var number = function(x) {
var succ = function() { return x+1; };
var pred = function() { return x-1; };
var this_ = {"succ": succ, "pred": pred};
return this_;
};
var test = function() {
var this_ = {};
return [number(0).succ == 1, number(0).pred == -1];
};
var this_ = {"number": number, "test": test};
return this_;
}
The language has no way to express side-effects yet, so I imagine it to be embedded in a bigger language.
timeout(sec, cond): stateful(State(null), cond).timeouted
State(start)
impulse(i): State(start and i ? start : now)
timeouted: now - start >= sec
The idea here ^ is that cond is a data-source of true and false values. And `timeout(5, data)` will be `true` three seconds after the last `false` message on the channel.