Libraryless. Click here for Pure Java version (9208L/51K).
1 | static int[] intArray_minus(int[] array, int x) { |
2 | if (x == 0 || empty(array)) ret array; |
3 | int n = array.length; |
4 | int[] b = new[n]; |
5 | for i to n: |
6 | b[i] = array[i]-x; |
7 | ret b; |
8 | } |
9 | |
10 | static int[] intArray_minus(int x, int[] array) { |
11 | ret intArray_minus(array, x); |
12 | } |
13 | |
14 | static int[] intArray_minus(int[] array1, int[] array2) { |
15 | int n = l(array1); |
16 | if (l(array2) != n) fail("Need same size"); |
17 | if (n == 0) ret array1; |
18 | int[] b = new[n]; |
19 | for i to n: |
20 | b[i] = array1[i]-array2[i]; |
21 | ret b; |
22 | } |
download show line numbers debug dex old transpilations
Travelled to 7 computer(s): bhatertpkbcr, mqqgnosmbjvj, pyentgdyhuwx, pzhvpgtvlbxg, tvejysmllsmz, vouqrxazstgt, xrpafgyirdlv
No comments. add comment
Snippet ID: | #1029079 |
Snippet name: | intArray_minus |
Eternal ID of this version: | #1029079/3 |
Text MD5: | 4712f243d2a6635009c15e91c3d4640b |
Transpilation MD5: | 4cf96e0456889ca72c664987d4e82aa8 |
Author: | stefan |
Category: | javax |
Type: | JavaX fragment (include) |
Public (visible to everyone): | Yes |
Archived (hidden from active list): | No |
Created/modified: | 2022-08-05 16:09:25 |
Source code size: | 519 bytes / 22 lines |
Pitched / IR pitched: | No / No |
Views / Downloads: | 177 / 291 |
Version history: | 2 change(s) |
Referenced in: | [show references] |