1
0
mirror of https://github.com/JustinSDK/dotSCAD.git synced 2025-08-16 19:54:29 +02:00
This commit is contained in:
Justin Lin
2020-05-24 16:24:26 +08:00
parent 3409d714a1
commit 50254eb7f7
3 changed files with 33 additions and 1 deletions

View File

@@ -208,6 +208,9 @@ See [examples](examples).
### Util
- [util/sum](https://openhome.cc/eGossip/OpenSCAD/lib2x-sum.html)
- [util/zip](https://openhome.cc/eGossip/OpenSCAD/lib2x-zip.html)
----
## Bugs and Feedback

19
docs/lib2x-zip.md Normal file
View File

@@ -0,0 +1,19 @@
# zip
Make a list that aggregates elements from each of the lists. Returns a list of lists, where the i-th list contains the i-th element from each of the argument lists. The `zip` function stops when the first input list is exhausted.
**Since:** 2.4
## Parameters
- `lts` : a list of lists.
## Examples
use <util/zip.scad>;
xs = [10, 20, 30];
ys = [5, 15, 25];
zs = [2.5, 7.5, 12.4];
assert(zip([xs, ys, zs]) == [[10, 5, 2.5], [20, 15, 7.5], [30, 25, 12.4]]);

View File

@@ -1,3 +1,13 @@
/**
* zip.scad
*
* @copyright Justin Lin, 2020
* @license https://opensource.org/licenses/lgpl-3.0.html
*
* @see https://openhome.cc/eGossip/OpenSCAD/lib2x-zip.html
*
**/
use <_impl/_zip_impl.scad>;
function zip(lists) = _zipAll(lists);
function zip(lts) = _zipAll(lts);