Commit e3c17c78 authored by Jack Q's avatar Jack Q
Browse files

Add higher order function test cases

parent 5fd6dc11
# 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
# 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
# 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
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment