From e54f896a1ad1115a0b897d47e28f1633a75ea59d Mon Sep 17 00:00:00 2001 From: adrianVmariano Date: Wed, 12 Jun 2019 20:08:53 -0400 Subject: [PATCH] Add files via upload --- arrays.scad | 14 ++++++++++++++ 1 file changed, 14 insertions(+) diff --git a/arrays.scad b/arrays.scad index 02b8f4e..5dd62c1 100644 --- a/arrays.scad +++ b/arrays.scad @@ -186,6 +186,20 @@ function list_set(indices,values,list=[],dflt=0,minlen=0) = replist(dflt, minlen-lastind-1) ); +// Function: list_increasing() +// Usage: +// list_increasing(list) +// Description: returns true if the list is (non-strictly) increasing +function list_increasing(list,ind=0) = ind < len(list)-1 && list[ind]<=list[ind+1] ? list_increasing(list,ind+1) : + (ind>=len(list)-1 ? true : false); + + +// Function: list_decreasing() +// Usage: +// list_increasing(list) +// Description: returns true if the list is (non-strictly) decreasing +function list_decreasing(list,ind=0) = ind < len(list)-1 && list[ind]>=list[ind+1] ? list_increasing(list,ind+1) : + (ind>=len(list)-1 ? true : false); // Function: list_remove()