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
e3c17c78
Commit
e3c17c78
authored
Mar 13, 2021
by
Jack Q
Browse files
Add higher order function test cases
parent
5fd6dc11
Changes
3
Hide whitespace changes
Inline
Side-by-side
valid/function/higher_order_functions/higherManyVars.wacc
0 → 100644
View file @
e3c17c78
# higher order functions with many variables
# Output:
# 6
# Exit:
# 0
# Program:
begin
int g(int a, int b, int c) is
return a + b + c
end
int{int, int, int} f(int{int, int, int} d) is
return d
end
int{int, int, int} x = call f(g);
int y = call x(2, 4, 0);
println y
end
\ No newline at end of file
valid/function/higher_order_functions/higherNested.wacc
0 → 100644
View file @
e3c17c78
# basic higher order function declaration and use
# Output:
# 2
# Exit:
# 0
# Program:
begin
int g(int a) is
return a
end
int{int} f(int{int} d) is
return d
end
int{int} i(int{int}{int{int}} e, int{int} a) is
int{int} k = call e(a);
return k
end
int{int} x = call i(f, g);
int y = call x(4);
println y
end
\ No newline at end of file
valid/function/higher_order_functions/higherOrderSimple.wacc
0 → 100644
View file @
e3c17c78
# basic higher order function declaration and use
# Output:
# 2
# Exit:
# 0
# Program:
begin
int g(int a) is
return a
end
int{int} f(int{int} d) is
return d
end
int{int} x = call f(g);
int y = call x(2);
println y
end
\ No newline at end of file
Write
Preview
Markdown
is supported
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