Transpiled version (9165L) is out of date.
1 | static long stupidFib_collab(ICollab collab, int n) { |
2 | new Var<Long> var; |
3 | stupidFib_collab(collab, n, result -> { |
4 | var.set(result); |
5 | collab.done(); |
6 | }); |
7 | collab.run(); |
8 | ret var!; |
9 | } |
10 | |
11 | svoid stupidFib_collab(ICollab collab, int n, LongConsumer continuation) { |
12 | if (n < 3) ret with continuation.accept(1L); |
13 | |
14 | LongPairCollector collector = new { |
15 | void complete(long a, long b) { |
16 | continuation.accept(a+b); |
17 | } |
18 | }; |
19 | |
20 | collab.addWork(-> stupidFib_collab(collab, n-1, collector.setterForA())); |
21 | collab.addWork(-> stupidFib_collab(collab, n-2, collector.setterForB())); |
22 | } |
Began life as a copy of #1035559
download show line numbers debug dex old transpilations
Travelled to 3 computer(s): elmgxqgtpvxh, mowyntqkapby, mqqgnosmbjvj
No comments. add comment
Snippet ID: | #1035566 |
Snippet name: | stupidFib_collab - Stupid-Fib in parallel (old) |
Eternal ID of this version: | #1035566/12 |
Text MD5: | 48cc5845d2b7cf3082fb12082ec1a29f |
Author: | stefan |
Category: | javax / maths |
Type: | JavaX fragment (include) |
Public (visible to everyone): | Yes |
Archived (hidden from active list): | No |
Created/modified: | 2022-06-19 02:14:22 |
Source code size: | 613 bytes / 22 lines |
Pitched / IR pitched: | No / No |
Views / Downloads: | 171 / 326 |
Version history: | 11 change(s) |
Referenced in: | [show references] |