Caterpillar

Daily Thought - 2024-06-23

< back to list

Caterpillar has a stack-based evaluation model. But despite that, functions have to specify named arguments. In addition, you can bind values to names within a function.

Here's some pseudocode (because again, Caterpillar still has no syntax):

fn square_then_times_five ( x )
{
    x x * => squared .
    squared 5 * => times_five .
    times_five
}

Here, each intermediate result is bound to a name. In most languages, this would be called a "variable", but in Caterpillar they are called "bindings". (Because they are supposed to be immutable, i.e. not actually variable.)

<< previous thoughtnext thought >>