Commit e440d8ca authored by Males, Sebastian's avatar Males, Sebastian
Browse files

[lj1019] Add more tests for lambdas & hof

parent f02b39af
# Assigns wrong type to a lambda.
# Output:
# #semantic_error#
# Exit:
# 200
# Program:
begin
bool{int} f = (\(bool x) -> x)
end
# Tries to use inexistent variable in lambda.
# Tries to use nonexistent variable in lambda.
# Output:
# #semantic_error#
......
# Take a lambda which operates on a pair
# Output:
# 3
# Exit:
# 0
# Program:
begin
int[] a = [1,2,3];
int{int[]} x = (\(int[] arr) -> 4 * len arr);
int y = call x(a);
println y
end
\ No newline at end of file
# Take a lambda which operates on a pair
# Output:
# 12
# Exit:
# 0
# Program:
begin
pair(int, int){pair(int, int)} x = (\(pair(int,int) p) -> p);
pair(int, int) p = newpair(10, 2);
pair(int, int) y = call x(p);
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