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).

macro mapToDoubleArray_body {
  int n = l(l);
  double[] a = new[n];
  Iterator<A> it = iterator(l);
  for i to n:
    a[i] = f.get(it.next());
  ret a;
}

static <A> double[] mapToDoubleArray(Cl<A> l, IF1<A, Double> f) {
  mapToDoubleArray_body
}

static double[] mapToDoubleArray(double[] l, IF1_DoubleToDouble f) {
  int n = l(l);
  double[] a = new[n];
  for i to n:
    a[i] = f.get(l[i]);
  ret a;
}


/*static <A> double[] mapToDoubleArray(Cl<A> l, IF1_ObjectToDouble<A> f) {
  mapToDoubleArray_body
}*/

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: 200 / 311
Version history: 7 change(s)
Referenced in: [show references]