Daily Note - 2025-02-19
Hey, I'm Hanno! These are my daily notes on Crosscut, the programming language I'm creating. If you have any questions, comments, or feedback, please get in touch!
Except for the erroneous concatenation of two integer literals from yesterday, we've only seen expressions that consist of a single syntax node. Let's look into some more complex, but still valid, expressions today.
64 halve
Here, we're using a halve
function that
takes an integer as input and returns another integer
(divided by two) as output. Such a function currently
doesn't exist in Crosscut, but a host could easily
define it.
I've talked about the active value before. Here, the active value at the
beginning of the expression is nothing
(of
type Nothing
). After the 64
,
it's 64
(of type Integer
).
After the halve
, it's 32
(still of type Integer
).
We can build more complex expressions, by chaining more function applications of the appropriate type:
64 halve halve double double
In this one, if the double
function does
what its name suggests and multiplies by two, we end up
with 64
again.