-
Notifications
You must be signed in to change notification settings - Fork 5
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Implementing support for function objects that only take one tuple pa…
…ramter
- Loading branch information
Showing
3 changed files
with
27 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
14 changes: 14 additions & 0 deletions
14
src/test/resources/testPrograms/functionObjects/tuple1function.monty
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,14 @@ | ||
// Testing: 1-Tuple function objects without 1-Tuples | ||
// | ||
// Expected Output: 1\n8\n | ||
|
||
// a function that takes exactly one tuple | ||
Int takeFirst( (Int, Int) t): | ||
return t._1 | ||
// and a function variable that points to this function | ||
(Int, Int) -> Int fn := takeFirst | ||
|
||
// call the function the standard way | ||
println(takeFirst((1,2))) | ||
// call the function variable with a tuple | ||
println( fn((8,2)) ) |
2 changes: 2 additions & 0 deletions
2
src/test/resources/testPrograms/functionObjects/tuple1function.output
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,2 @@ | ||
1 | ||
8 |