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

35
LINES

< > BotCompany Repo | #1005301 // pcallF - synonym of pcallFunction

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

Libraryless. Click here for Pure Java version (5033L/28K).

static O pcallF(O f, O... args) {
  ret pcallFunction(f, args);
}

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

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

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

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

static <A> A pcallF(IF0<A> f) {
  pcall { ret f?!; } null;
}

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

Author comment

Began life as a copy of #1003403

download  show line numbers  debug dex  old transpilations   

Travelled to 23 computer(s): aoiabmzegqzx, bhatertpkbcr, cbybwowwnfue, cfunsshuasjs, ddnzoavkxhuk, ekrmjmnbrukm, elmgxqgtpvxh, gwrvuhgaqvyk, ishqpsrjomds, jcllbfdqhrgy, lpdgvwnxivlt, mowyntqkapby, mqqgnosmbjvj, onxytkatvevr, podlckwnjdmb, pyentgdyhuwx, pzhvpgtvlbxg, tslmcundralx, tvejysmllsmz, vouqrxazstgt, whxojlpjdney, wnsclhtenguj, yanjaxplzisb

No comments. add comment

Snippet ID: #1005301
Snippet name: pcallF - synonym of pcallFunction
Eternal ID of this version: #1005301/11
Text MD5: 74aae813c14ba404ea28246a9f310eed
Transpilation MD5: a08f5a6bdc6f14192b9405bc25bb53eb
Author: stefan
Category: javax
Type: JavaX fragment (include)
Public (visible to everyone): Yes
Archived (hidden from active list): No
Created/modified: 2022-01-31 21:27:46
Source code size: 560 bytes / 35 lines
Pitched / IR pitched: No / No
Views / Downloads: 981 / 3675
Version history: 10 change(s)
Referenced in: #1006654 - Standard functions list 2 (LIVE, continuation of #761)
#1010837 - pcallF_all - call multiple functions
#1020756 - pcallFInRealMC - pcallF + adjust for real main class
#1031734 - pcallF_if0
#1034618 - pcallF_typed