Daily Thought - 2024-10-05
< back to listCaterpillar is currently using {}
to delineate functions. Here's an example of
that:
{
\ a 0 ->
a
\ a b ->
a b +
}
This is a function with two branches. The first branch is executed, if the
second argument is 0
; the second branch is executed otherwise.
I'm thinking about replacing the braces with new fn
and end
keywords:
fn
\ a 0 ->
a
\ a b ->
a b +
end
In my opinion, this has two advantages:
- It is more obvious to the uninitiated.
fn
makes it relatively clear, that this is a function. - It frees up
{}
for other uses.
But it would also introduce two new keywords, which then would not be available as function names.