Commit b58a101a by Jack Q

### Merge branch 'master' of gitlab.doc.ic.ac.uk:sm919/wacc_examples

parents 2a86f468 86caa57d
 # 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: # Output: # #semantic_error# # #semantic_error# ... ...
 # Take a lambda which operates on a pair # Output: # 12 # 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: # [addr] # 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
 ... @@ -9,11 +9,12 @@ ... @@ -9,11 +9,12 @@ # Program: # Program: begin begin int{int} f(int{int, int, int} d) is int{int, int, int} f(int{int, int, int} d) is return d return d end end int{int} x = call f(\(int x, int y, int z) -> x + y + z); int{int, int, int} lambda = (\(int x, int y, int z) -> x + y + z); int y = call x(1,2,3); int{int, int, int} bar = call f(lambda); int y = call bar(1,2,3); println y println y end 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!