1
0
mirror of https://github.com/JustinSDK/dotSCAD.git synced 2025-08-13 10:14:41 +02:00

refactor: don't use each

This commit is contained in:
Justin Lin
2022-04-17 20:04:38 +08:00
parent 92190fbb21
commit 7bcf5d8f27

View File

@@ -5,9 +5,9 @@
* @license https://opensource.org/licenses/lgpl-3.0.html
*
* @see https://openhome.cc/eGossip/OpenSCAD/lib3x-swap.html
*
*
**/
function swap(lt, i, j) =
i == j ? lt :
let(
@@ -17,9 +17,8 @@ function swap(lt, i, j) =
b = ab[1]
)
[
each [for(idx = 0; idx < a; idx = idx + 1) lt[idx]],
lt[b],
each [for(idx = a + 1; idx < b; idx = idx + 1) lt[idx]],
lt[a],
each [for(idx = b + 1; idx < leng; idx = idx + 1) lt[idx]]
for(i = [0:leng - 1])
if(i == a) lt[b]
else if(i == b) lt[a]
else lt[i]
];