Not logged in.  Login/Logout/Register | List snippets | | Create snippet | Upload image | Upload data

59
LINES

< > BotCompany Repo | #1033316 // callF_gen - generalized callF (in case we strongly type callF? I forget what the plan is with this. anyway, we are *calling functions* [that's it])

JavaX fragment (include) [tags: use-pretranspiled]

Libraryless. Click here for Pure Java version (4483L/25K).

1  
ifclass F0
2  
  static <A> A callF_gen(F0<A> f) {
3  
    ret f?!;
4  
  }
5  
endif
6  
7  
ifclass F1
8  
  static <A, B> B callF_gen(F1<A, B> f, A a) {
9  
    ret f?.get(a);
10  
  }
11  
endif
12  
13  
ifclass IF0
14  
  static <A> A callF_gen(IF0<A> f) {
15  
    ret f?!;
16  
  }
17  
endif
18  
19  
ifclass IF1
20  
  static <A, B> B callF_gen(IF1<A, B> f, A a) {
21  
    ret f?.get(a);
22  
  }
23  
endif
24  
25  
static <A, B> B callF_gen(A a, IF1<A, B> f) {
26  
  ret f?.get(a);
27  
}
28  
29  
ifclass F2
30  
  static <A, B, C> C callF_gen(F2<A, B, C> f, A a, B b) {
31  
    ret f?.get(a, b);
32  
  }
33  
endif
34  
35  
ifclass IF2
36  
  static <A, B, C> C callF_gen(IF2<A, B, C> f, A a, B b) {
37  
    ret f?.get(a, b);
38  
  }
39  
endif
40  
41  
ifclass VF1
42  
  static <A> void callF_gen(VF1<A> f, A a) {
43  
    f?.get(a);
44  
  }
45  
endif
46  
47  
static <A> void callF_gen(A a, IVF1<A> f) {
48  
  f?.get(a);
49  
}
50  
51  
static <A> void callF_gen(IVF1<A> f, A a) {
52  
  f?.get(a);
53  
}
54  
55  
sO callF_gen(Runnable r) { r?.run(); null; }
56  
57  
sO callF_gen(O f, O... args) {
58  
  ret callF(f, args);
59  
}

download  show line numbers  debug dex  old transpilations   

Travelled to 3 computer(s): bhatertpkbcr, ekrmjmnbrukm, mqqgnosmbjvj

No comments. add comment

Snippet ID: #1033316
Snippet name: callF_gen - generalized callF (in case we strongly type callF? I forget what the plan is with this. anyway, we are *calling functions* [that's it])
Eternal ID of this version: #1033316/6
Text MD5: 1de6cb6bf7d9400cc7335392654044e6
Transpilation MD5: 2acfed554970e4bbeb6138f9efc6962e
Author: someone
Category:
Type: JavaX fragment (include)
Public (visible to everyone): Yes
Archived (hidden from active list): No
Created/modified: 2021-10-23 03:10:59
Source code size: 955 bytes / 59 lines
Pitched / IR pitched: No / No
Views / Downloads: 131 / 180
Version history: 5 change(s)
Referenced in: [show references]