1 | static L map_pcall(Iterable l, O f) { |
2 | ret map_pcall(f, l); |
3 | } |
4 | |
5 | static L map_pcall(O f, Iterable l) { |
6 | new L x; |
7 | for (O o : unnull(l)) pcall { x.add(callF(f, o)); } |
8 | ret x; |
9 | } |
10 | |
11 | static L map_pcall(O f, O[] l) { |
12 | new L x; |
13 | for (O o : unnull(l)) pcall { x.add(callF(f, o)); } |
14 | ret x; |
15 | } |
16 | |
17 | static <A, B> L<B> map_pcall(Iterable<A> l, IF1<A, B> f) { |
18 | L x = emptyList(l); |
19 | if (l != null) for (A o : l) pcall { |
20 | x.add(f.get(o)); |
21 | } |
22 | ret x; |
23 | } |
24 | |
25 | static <A, B> L<B> map_pcall(IF1<A, B> f, Iterable<A> l) { |
26 | ret map_pcall(l, f); |
27 | } |
Began life as a copy of #1003239
download show line numbers debug dex old transpilations
Travelled to 14 computer(s): aoiabmzegqzx, bhatertpkbcr, cbybwowwnfue, cfunsshuasjs, gwrvuhgaqvyk, ishqpsrjomds, lpdgvwnxivlt, mqqgnosmbjvj, pyentgdyhuwx, pzhvpgtvlbxg, tslmcundralx, tvejysmllsmz, vouqrxazstgt, xrpafgyirdlv
No comments. add comment
Snippet ID: | #1010000 |
Snippet name: | map_pcall - map() with safe calling (skip elements when failed) |
Eternal ID of this version: | #1010000/4 |
Text MD5: | d31adc103e120f77b0395c1cb236c3bd |
Author: | stefan |
Category: | javax |
Type: | JavaX fragment (include) |
Public (visible to everyone): | Yes |
Archived (hidden from active list): | No |
Created/modified: | 2020-02-25 12:57:18 |
Source code size: | 555 bytes / 27 lines |
Pitched / IR pitched: | No / No |
Views / Downloads: | 442 / 511 |
Version history: | 3 change(s) |
Referenced in: | [show references] |