arrow lambdas

This commit is contained in:
2021-02-17 09:33:27 -07:00
parent aa0f6d29c1
commit ace37b7595
3 changed files with 45 additions and 2 deletions

View File

@@ -281,6 +281,10 @@ class BasicTestCase extends Test {
function testKissStrings() {
_testKissStrings();
}
function testArrowLambdas() {
_testArrowLambdas();
}
}
class BasicObject {

View File

@@ -466,4 +466,17 @@
num 3
l1 ["a" "b" "c"]
l2 [1 2 3]]
(Assert.equals "it's 3asy as [a,b,c] [1,2,3]" "$str ${num}asy as $l1 $l2")))
(Assert.equals "it's 3asy as [a,b,c] [1,2,3]" "$str ${num}asy as $l1 $l2")))
(defun _testArrowLambdas []
(let [withArgs
->[arg1 arg2] (+ arg1 arg2)
withArg
->arg (* 2 arg)
withoutArgs
->{
(+ 5)
6}]
(Assert.equals 11 (withArgs 5 6))
(Assert.equals 12 (withArg 6))
(Assert.equals 6 (withoutArgs))))