Libraryless. Click here for Pure Java version (4426L/25K).
1 | static <A> Scored<A> lambdaMapLike bestOfN_stopAtScore(IF1<A, Double> scoreFunction, double stopScore, int nMax, IF0<A> produce) { |
2 | new Best<A> best; |
3 | |
4 | repeat nMax { |
5 | A a = produce!; |
6 | double score = scoreFunction.get(a); |
7 | best.put(a, score); |
8 | if (score >= stopScore) break; |
9 | } |
10 | |
11 | ret best.scored(); |
12 | } |
Began life as a copy of #1032499
download show line numbers debug dex old transpilations
Travelled to 4 computer(s): bhatertpkbcr, mowyntqkapby, mqqgnosmbjvj, pyentgdyhuwx
No comments. add comment
Snippet ID: | #1032510 |
Snippet name: | bestOfN_stopAtScore |
Eternal ID of this version: | #1032510/1 |
Text MD5: | 0ba4d6c89f65f65f4cd33ea57eb07bf5 |
Transpilation MD5: | 400f20917777659fcefeadd65c5f9252 |
Author: | stefan |
Category: | javax |
Type: | JavaX fragment (include) |
Public (visible to everyone): | Yes |
Archived (hidden from active list): | No |
Created/modified: | 2021-09-12 09:56:11 |
Source code size: | 330 bytes / 12 lines |
Pitched / IR pitched: | No / No |
Views / Downloads: | 147 / 211 |
Referenced in: | [show references] |