diff options
| author | Bruce Hill <bruce@bruce-hill.com> | 2025-04-06 16:07:23 -0400 |
|---|---|---|
| committer | Bruce Hill <bruce@bruce-hill.com> | 2025-04-06 16:07:23 -0400 |
| commit | 6782cc5570e194791ca6cdd695b88897e9145564 (patch) | |
| tree | a428e9d954aca251212ec1cf15bd35e0badce630 /test/lambdas.tm | |
| parent | 448e805293989b06e07878a4a87fdd378f7c6e02 (diff) | |
No more colons for blocks
Diffstat (limited to 'test/lambdas.tm')
| -rw-r--r-- | test/lambdas.tm | 28 |
1 files changed, 14 insertions, 14 deletions
diff --git a/test/lambdas.tm b/test/lambdas.tm index 6e261e0f..d6501cb7 100644 --- a/test/lambdas.tm +++ b/test/lambdas.tm @@ -1,18 +1,18 @@ -func make_adder(x:Int -> func(y:Int->Int)): - return func(y:Int): x + y +func make_adder(x:Int -> func(y:Int->Int)) + return func(y:Int) x + y -func suffix_fn(fn:func(t:Text->Text), suffix:Text -> func(t:Text->Text)): - return func(t:Text): fn(t)++suffix +func suffix_fn(fn:func(t:Text->Text), suffix:Text -> func(t:Text->Text)) + return func(t:Text) fn(t)++suffix -func mul_func(n:Int, fn:func(x:Int->Int) -> func(x:Int->Int)): - return func(x:Int): n*fn(x) +func mul_func(n:Int, fn:func(x:Int->Int) -> func(x:Int->Int)) + return func(x:Int) n*fn(x) -func main(): - >> add_one := func(x:Int): x + 1 +func main() + >> add_one := func(x:Int) x + 1 >> add_one(10) = 11 - >> shout := func(msg:Text): say("$(msg.upper())!") + >> shout := func(msg:Text) say("$(msg.upper())!") >> shout("hello") >> asdf := add_one @@ -23,7 +23,7 @@ func main(): >> add_100(5) = 105 - >> shout2 := suffix_fn(func(t:Text): t.upper(), "!") + >> shout2 := suffix_fn(func(t:Text) t.upper(), "!") >> shout2("hello") = "HELLO!" @@ -33,10 +33,10 @@ func main(): # Test nested lambdas: outer := "Hello" - fn := func(): - return func(): - return func(): - defer: say("$outer") + fn := func() + return func() + return func() + defer say("$outer") return outer >> fn()()() = "Hello" |
