mirror of
https://codeberg.org/ProgramSnail/lang_2023.git
synced 2025-12-07 07:28:44 +00:00
16 lines
350 B
Text
16 lines
350 B
Text
|
|
decl test_lambdas : Unit -> Unit
|
||
|
|
def test_lambdas = {
|
||
|
|
const lambda1 = \x -> x * x
|
||
|
|
// const lambda2 = \(x : #Hash) -> x.hash // ??
|
||
|
|
const lambda3 = \x y -> x + y
|
||
|
|
|
||
|
|
// TODO: type LambdaType = Int -> Int // ?? type keyword ??
|
||
|
|
// const typed_lambda = \x -> x + 1
|
||
|
|
|
||
|
|
const lambda4 = \x -> {
|
||
|
|
; IO.print x
|
||
|
|
const y = x + x
|
||
|
|
return y
|
||
|
|
}
|
||
|
|
}
|