-
-
Save alphaKAI/3f8df9dddb96bb804573 to your computer and use it in GitHub Desktop.
グローバルなラムダでメタプログラミング的なものをやってみた図
This file contains hidden or 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
| import std.stdio, | |
| std.array, | |
| std.range; | |
| auto x = (int[] arr) pure nothrow @nogc @safe { return ++arr[0] * 2; }; | |
| int[] fx(int[] xss){ return xss.length ? x(xss) ~ fx(xss[1..$]) : xss; } | |
| void main(){ | |
| writeln(fx(100.iota.array)); | |
| x = (int[] arr) pure nothrow @nogc @safe { return ++arr[0] * 3; }; | |
| writeln(fx(100.iota.array)); | |
| } |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment