change syntax for callable

anything that can be applied is now callable, this is the first step for
closure, partial application, and call-by-value
This commit is contained in:
2024-03-29 14:45:17 +07:00
parent 6a27f8fdf8
commit 6ad5cbb586
3 changed files with 28 additions and 8 deletions

View File

@ -41,4 +41,16 @@ increment : fn number => number = function x is
is_even : fn number => bool = function x is
if x % 2 then true else false
; invoke a function by name
bruh : number = increment(one)
; invoke a lambda function
bruh1 : number = (function x is x)(1)
; invoke a calculation returns a function
bruh2 : fn bool => number = function cond is
(if cond then
function x is x + 1
else
function x is x + 2
)(0)