From 50254eb7f75d75d4b9380bf014418cd805ebfd67 Mon Sep 17 00:00:00 2001 From: Justin Lin Date: Sun, 24 May 2020 16:24:26 +0800 Subject: [PATCH] add doc --- README.md | 3 +++ docs/lib2x-zip.md | 19 +++++++++++++++++++ src/util/zip.scad | 12 +++++++++++- 3 files changed, 33 insertions(+), 1 deletion(-) create mode 100644 docs/lib2x-zip.md diff --git a/README.md b/README.md index 97fdbc78..1fc9d2d6 100644 --- a/README.md +++ b/README.md @@ -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 diff --git a/docs/lib2x-zip.md b/docs/lib2x-zip.md new file mode 100644 index 00000000..ac11c33f --- /dev/null +++ b/docs/lib2x-zip.md @@ -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 ; + + 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]]); \ No newline at end of file diff --git a/src/util/zip.scad b/src/util/zip.scad index 1bfc5aa6..a5255457 100644 --- a/src/util/zip.scad +++ b/src/util/zip.scad @@ -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); \ No newline at end of file +function zip(lts) = _zipAll(lts); \ No newline at end of file