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

25
LINES

< > BotCompany Repo | #1030554 // mapToDoubleArray

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

Libraryless. Click here for Pure Java version (9954L/54K).

1  
macro mapToDoubleArray_body {
2  
  int n = l(l);
3  
  double[] a = new[n];
4  
  Iterator<A> it = iterator(l);
5  
  for i to n:
6  
    a[i] = f.get(it.next());
7  
  ret a;
8  
}
9  
10  
static <A> double[] mapToDoubleArray(Cl<A> l, IF1<A, Double> f) {
11  
  mapToDoubleArray_body
12  
}
13  
14  
static double[] mapToDoubleArray(double[] l, IF1_DoubleToDouble f) {
15  
  int n = l(l);
16  
  double[] a = new[n];
17  
  for i to n:
18  
    a[i] = f.get(l[i]);
19  
  ret a;
20  
}
21  
22  
23  
/*static <A> double[] mapToDoubleArray(Cl<A> l, IF1_ObjectToDouble<A> f) {
24  
  mapToDoubleArray_body
25  
}*/

Author comment

Began life as a copy of #1015540

download  show line numbers  debug dex  old transpilations   

Travelled to 4 computer(s): bhatertpkbcr, mqqgnosmbjvj, pyentgdyhuwx, vouqrxazstgt

No comments. add comment

Snippet ID: #1030554
Snippet name: mapToDoubleArray
Eternal ID of this version: #1030554/8
Text MD5: 9048f3d89d5eae6d873608fe89102ac7
Transpilation MD5: 21b430803b30b43b9c3120996bbf9ac5
Author: stefan
Category: javax
Type: JavaX fragment (include)
Public (visible to everyone): Yes
Archived (hidden from active list): No
Created/modified: 2022-12-12 01:29:43
Source code size: 534 bytes / 25 lines
Pitched / IR pitched: No / No
Views / Downloads: 297 / 429
Version history: 7 change(s)
Referenced in: [show references]