Skip to content
GitLab
Menu
Projects
Groups
Snippets
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
Menu
Open sidebar
Males, Sebastian
wacc_examples
Commits
cd08864c
Commit
cd08864c
authored
Mar 11, 2021
by
lj1019
Browse files
Add lambda tests
parent
a9f3dd50
Changes
5
Hide whitespace changes
Inline
Side-by-side
valid/function/lambdas/callLambdaInALoop.wacc
0 → 100644
View file @
cd08864c
# Call lambdas repetitively
# Output:
# 0
# 1
# 2
# 3
# 4
# Program:
begin
int n = 5
int i = 0 ;
while i < n do
println call (\() -> i)() ;
i = i + 1;
done ;
end
valid/function/lambdas/callSimpleLambda.wacc
0 → 100644
View file @
cd08864c
# Assign to a variable ad print the result of the lambda
# Output:
# 6
# Program:
begin
int y = call (\(int x, int y) -> x * y)(2, 3);
print y
end
\ No newline at end of file
valid/function/lambdas/lambdaInsideFunction.wacc
0 → 100644
View file @
cd08864c
# Call lambda inside a function
# Output:
# 6
# Program:
begin
int f(int x, int y) is
return call (\(int x, int y) -> x * y)(x,y)
end
int y = f(2,3)
print y
end
\ No newline at end of file
valid/function/lambdas/lambdaWithManyArgs.wacc
0 → 100644
View file @
cd08864c
# call lambdas repetitively
# Output:
# 5
# Program:
begin
print call (\(int x, int y, bool z, bool a, bool b, string c) -> x + y)(2, 3, false, false, true, "hello")
end
\ No newline at end of file
valid/function/lambdas/simpleLambda.wacc
0 → 100644
View file @
cd08864c
# a simple lambda is declared, but not called
# Output:
# #empty#
# Program:
begin
call (\(int x, int y) -> x * y)(2, 3)
skip
end
Write
Preview
Supports
Markdown
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment