Initial data commit
This commit is contained in:
parent
72d218235f
commit
f23f22d71c
199087 changed files with 3378941 additions and 0 deletions
19
Task/Call-a-function/Ecstasy/call-a-function-9.ecstasy
Normal file
19
Task/Call-a-function/Ecstasy/call-a-function-9.ecstasy
Normal file
|
|
@ -0,0 +1,19 @@
|
|||
module PartialApplication {
|
||||
void foo(String s, Int i, Dec d) {
|
||||
@Inject Console console;
|
||||
console.print($"inside call to foo({s=}, {i=}, {d=})");
|
||||
}
|
||||
|
||||
void run() {
|
||||
// note that the "&" obtains the reference to the function, and suppresses the
|
||||
// invocation thereof, so it is *allowed* in all three of these cases, but it
|
||||
// is *required* in the third case:
|
||||
function void(String, Int, Dec) unbound = foo; // or "foo(_, _, _)"
|
||||
function void(String, Dec) partBound = unbound(_, 99, _);
|
||||
function void() allBound = &partBound("world", 3.14);
|
||||
|
||||
unbound("nothing", 0, 0.0);
|
||||
partBound("hello", 2.718);
|
||||
allBound();
|
||||
}
|
||||
}
|
||||
Loading…
Add table
Add a link
Reference in a new issue