static O mapLike curry(fO f, fO arg) { int n = numberOfFunctionArguments(f); if (n == 0) fail("function takes no arguments"); if (n == 1) ret new F0 { O get() { ret callF(f, arg); } toString { ret "curry(" + f + ", " + sfu(arg) + ")"; } }; if (n == 2) ret new F1 { O get(O a) { ret callF(f, arg, a); } toString { ret "curry(" + f + ", " + sfu(arg) + ")"; } }; throw todo("currying a function with " + n + "arguments"); }
download show line numbers debug dex old transpilations
Travelled to 13 computer(s): aoiabmzegqzx, bhatertpkbcr, cbybwowwnfue, cfunsshuasjs, gwrvuhgaqvyk, ishqpsrjomds, lpdgvwnxivlt, mqqgnosmbjvj, pyentgdyhuwx, pzhvpgtvlbxg, tslmcundralx, tvejysmllsmz, vouqrxazstgt
No comments. add comment
Snippet ID: | #1008681 |
Snippet name: | curry - curry a function |
Eternal ID of this version: | #1008681/8 |
Text MD5: | b0b5cdaffd2b90c968225a1d40bec999 |
Author: | stefan |
Category: | javax |
Type: | JavaX fragment (include) |
Public (visible to everyone): | Yes |
Archived (hidden from active list): | No |
Created/modified: | 2019-02-07 16:40:01 |
Source code size: | 515 bytes / 20 lines |
Pitched / IR pitched: | No / No |
Views / Downloads: | 666 / 661 |
Version history: | 7 change(s) |
Referenced in: | [show references] |