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).

ifclass F0
  static <A> A callF_gen(F0<A> f) {
    ret f?!;
  }
endif

ifclass F1
  static <A, B> B callF_gen(F1<A, B> f, A a) {
    ret f?.get(a);
  }
endif

ifclass IF0
  static <A> A callF_gen(IF0<A> f) {
    ret f?!;
  }
endif

ifclass IF1
  static <A, B> B callF_gen(IF1<A, B> f, A a) {
    ret f?.get(a);
  }
endif

static <A, B> B callF_gen(A a, IF1<A, B> f) {
  ret f?.get(a);
}

ifclass F2
  static <A, B, C> C callF_gen(F2<A, B, C> f, A a, B b) {
    ret f?.get(a, b);
  }
endif

ifclass IF2
  static <A, B, C> C callF_gen(IF2<A, B, C> f, A a, B b) {
    ret f?.get(a, b);
  }
endif

ifclass VF1
  static <A> void callF_gen(VF1<A> f, A a) {
    f?.get(a);
  }
endif

static <A> void callF_gen(A a, IVF1<A> f) {
  f?.get(a);
}

static <A> void callF_gen(IVF1<A> f, A a) {
  f?.get(a);
}

sO callF_gen(Runnable r) { r?.run(); null; }

sO callF_gen(O f, O... args) {
  ret callF(f, args);
}

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: 206 / 276
Version history: 5 change(s)
Referenced in: #1006654 - Standard functions list 2 (LIVE, continuation of #761)