aboutsummaryrefslogtreecommitdiff
path: root/test
diff options
context:
space:
mode:
authorBruce Hill <bruce@bruce-hill.com>2024-03-09 16:08:03 -0500
committerBruce Hill <bruce@bruce-hill.com>2024-03-09 16:08:03 -0500
commit00d4e98ba153c1f9beeae45c3ab50041ad3c34ef (patch)
tree445e7bb435ff5b949599e0503093e58f206612a3 /test
parentb04a1b30903636bf97a8e04efe88e8a177855bcb (diff)
Extra lambda test
Diffstat (limited to 'test')
-rw-r--r--test/lambdas.tm7
1 files changed, 7 insertions, 0 deletions
diff --git a/test/lambdas.tm b/test/lambdas.tm
index d896ea4b..ca2acb5d 100644
--- a/test/lambdas.tm
+++ b/test/lambdas.tm
@@ -24,3 +24,10 @@ func suffix_fn(fn:func(t:Text)->Text, suffix:Text)->func(t:Text)->Text
>> shout2 := suffix_fn(Text.upper, "!")
>> shout2("hello")
= "HELLO!"
+
+func mul_func(n:Int, fn:func(x:Int)->Int)-> func(x:Int)->Int
+ return func(x:Int) n*fn(x)
+
+>> abs100 := mul_func(100, Int.abs)
+>> abs100(-5)
+= 500