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

11
LINES

< > BotCompany Repo | #1033386 // partialSums_firstIs0

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

Libraryless. Click here for Pure Java version (4897L/27K).

1  
static L<Int> partialSums_firstIs0(L<Int> l) {
2  
  int n = l(l);
3  
  IntBuffer out = new(n);
4  
  int sum = 0;
5  
  for i to n: {
6  
    out.add(sum);
7  
    sum += l.get(i);
8  
  }
9  
  out.add(sum);
10  
  ret out.asVirtualList();
11  
}

download  show line numbers  debug dex  old transpilations   

Travelled to 3 computer(s): bhatertpkbcr, ekrmjmnbrukm, mqqgnosmbjvj

No comments. add comment

Snippet ID: #1033386
Snippet name: partialSums_firstIs0
Eternal ID of this version: #1033386/3
Text MD5: abc38c1c1ff81f9f2d48561c0cdd0905
Transpilation MD5: 44e7001c777af3f7e136acf05557b2f2
Author: stefan
Category: javax / maths
Type: JavaX fragment (include)
Public (visible to everyone): Yes
Archived (hidden from active list): No
Created/modified: 2021-10-27 01:27:53
Source code size: 217 bytes / 11 lines
Pitched / IR pitched: No / No
Views / Downloads: 97 / 146
Version history: 2 change(s)
Referenced in: [show references]