omdl  v1.0
OpenSCAD Mechanical Design Library
iterable_operate.scad File Reference

Iterable data type operations. More...

+ This graph shows which files directly or indirectly include this file:

Go to the source code of this file.

Functions and/or Modules

function defined_e_or (v, i, d)
 Returns an element from an iterable if it exists, or a default value if not. More...
 
function defined_eon_or (v, i, d)
 Returns the list element or scalar numeric value if defined, otherwise returns the default value. More...
 
function defined_eonb_or (v, i, d)
 Returns the list element or scalar numeric or boolean value if defined, otherwise returns the default value. More...
 
function defined_fle_or (v, i, d)
 Return the first defined specified element in a list of lists, otherwise returns the given default value. More...
 
function defined_ei_or (v, i, d, n)
 Returns an element from an iterable if it exists and is a iterable, otherwise returns a default value. More...
 
function find_all (mv, v)
 Find all occurrences of a match value in an iterable value. More...
 
function find (mv, v, c=1, i, i1=0, i2)
 Find the occurrences of a match value in an iterable value. More...
 
function count (mv, v, s=true, i)
 Count all occurrences of a match value in an iterable value. More...
 
function exists (mv, v, s=true, i)
 Check for the existence of a match value in an iterable value. More...
 
function exists_e (i, v)
 Test if an element exists at a specified index of an iterable value. More...
 
function first (v)
 Return the first element of an iterable value. More...
 
function second (v)
 Return the second element of an iterable value. More...
 
function third (v)
 Return the third element of an iterable value. More...
 
function last (v)
 Return the last element of an iterable value. More...
 
function middle (v)
 Return the middle element of an iterable value. More...
 
function first2 (v)
 Return a list containing the first two elements of an iterable value. More...
 
function first3 (v)
 Return a list containing the first three elements of an iterable value. More...
 
function last2 (v)
 Return a list containing the last two elements of an iterable value. More...
 
function last3 (v)
 Return a list containing the last three elements of an iterable value. More...
 
function firstn (v, n=1)
 Return a list containing the first n elements of an iterable value. More...
 
function lastn (v, n=1)
 Return a list containing the last n elements of an iterable value. More...
 
function headn (v, n=1)
 Return a list containing all but the last n elements of an iterable value. More...
 
function tailn (v, n=1)
 Return a list containing all but the first n elements of an iterable value. More...
 
function reverse (v)
 Reverse the elements of an iterable value. More...
 
function shift_cd (v, n=0, r=true, d=false)
 Circularly shift the elements of an iterable, with an optional element drop. More...
 
function shift_ci (v, n=0, r=true, i)
 Shift-in a value to the elements of a given iterable value. More...
 
function select_r (v, i)
 Select a range of elements from an iterable value. More...
 
function sequence_ns (v, n=1, s=1, w=false)
 Return a list of all n-element sequential-subsets of an iterable value. More...
 
function combine_ns (v, n)
 Return all n-sized set combinations of iterable value. More...
 
function permute_ns (v, n)
 Return all ordered n-sized set permutations of iterable value. More...
 
function permute_ns_r (v, n)
 Return all ordered n-size set permutations of iterable value with repetition allowed. More...
 
function append_e (nv, v, r=true, j=true, l=true)
 Append a value to each element of an iterable value. More...
 
function append_v (nv, v, n=0, r=false)
 Append a value to the end or beginning of an iterable value. More...
 
function insert (nv, v, i=0, mv, mi=0, s=true, si)
 Insert a new value into an iterable value. More...
 
function delete_first (v, mv, mc=1)
 Delete the first occurrence(s) of a matched value from an iterable value. More...
 
function delete_each (v, mv)
 Delete each match value from an iterable value. More...
 
function delete (v, i, mv, mc=1, s=true, si)
 Delete elements from an iterable value. More...
 
function replace_first (v, mv, nv, mc=1)
 Replace the first occurrence(s) of a matched value in iterable value. More...
 
function strip (v, mv=empty_lst)
 Strip all matching values from an iterable value. More...
 
function mask (v, m, r=false, o=0, u=undef, z=0)
 Apply a binary mask to an interable value. More...
 
function unique (v)
 Return a list of the unique elements of an iterable value. More...
 
function common (v1, v2, e=empty_lst)
 Return a list of the common elements of two iterable values. More...
 
function not_common (v1, v2)
 Return a list of the elements not present in both iterable values. More...
 

File Details

Iterable data type operations.

Author
Roy Allen Sutton
Date
2015-2026

This file is part of omdl, an OpenSCAD mechanical design library.

The omdl is free software; you can redistribute it and/or modify it under the terms of the GNU Lesser General Public License as published by the Free Software Foundation; either version 2.1 of the License, or (at your option) any later version.

The omdl is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more details.

You should have received a copy of the GNU Lesser General Public License along with the omdl; if not, write to the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA; or see http://www.gnu.org/licenses/.

Definition in file iterable_operate.scad.