mirror of
https://github.com/JustinSDK/dotSCAD.git
synced 2025-01-17 14:18:13 +01:00
add every
This commit is contained in:
parent
7183015fe1
commit
399c93e2d5
@ -137,6 +137,7 @@ These examples incubate dotSCAD and dotSCAD refactors these examples. See [examp
|
||||
- [util/bsearch](https://openhome.cc/eGossip/OpenSCAD/lib3x-bsearch.html)
|
||||
- [util/choose](https://openhome.cc/eGossip/OpenSCAD/lib3x-choose.html)
|
||||
- [util/dedup](https://openhome.cc/eGossip/OpenSCAD/lib3x-dedup.html)
|
||||
- [util/every](https://openhome.cc/eGossip/OpenSCAD/lib3x-every.html)
|
||||
- [util/fibseq](https://openhome.cc/eGossip/OpenSCAD/lib3x-fibseq.html)
|
||||
- [util/flat](https://openhome.cc/eGossip/OpenSCAD/lib2x-flat.html)
|
||||
- [util/has](https://openhome.cc/eGossip/OpenSCAD/lib2x-has.html)
|
||||
|
17
docs/lib3x-every.md
Normal file
17
docs/lib3x-every.md
Normal file
@ -0,0 +1,17 @@
|
||||
# every
|
||||
|
||||
The `every` function tests whether all elements in the list pass the test implemented by the provided function.
|
||||
|
||||
**Since:** 3.0
|
||||
|
||||
## Parameters
|
||||
|
||||
- `lt` : the list.
|
||||
- `test` : a test function that accepts an element and returns `true` or `false`.
|
||||
|
||||
## Examples
|
||||
|
||||
use <util/every.scad>;
|
||||
|
||||
biggerThanZero = function(elem) elem > 0;
|
||||
assert(every([1, 30, 39, 29, 10, 13], biggerThanZero));
|
@ -1,3 +1,13 @@
|
||||
/**
|
||||
* every.scad
|
||||
*
|
||||
* @copyright Justin Lin, 2021
|
||||
* @license https://opensource.org/licenses/lgpl-3.0.html
|
||||
*
|
||||
* @see https://openhome.cc/eGossip/OpenSCAD/lib3x-dedup.html
|
||||
*
|
||||
**/
|
||||
|
||||
use <_impl/_every.scad>;
|
||||
|
||||
function every(lt, test) = _every(lt, test, len(lt));
|
Loading…
x
Reference in New Issue
Block a user