Partial applicationその2
引数だけでなく、オブジェクトにも適用出来たりします。
class X { msg = null; public this (msg : string) { this.msg = msg; } public Say (key : string) : void { System.Console.WriteLine ($"$msg, $key"); } } def x1 = X ("Hello"); def x2 = X ("Goodbye"); // オブジェクトを省略 // xxはオブジェクトを引数に取る関数となる def xx = _.Say ("World"); xx (x1); // x1.Say("World")となる xx (x2); // x2.Say("World")となる /* 結果 Hello, World Goodbye, World */
やりすぎると、訳が分からなくなるかも。(^^;