### Example Usage of Type Checking Functions Source: https://github.com/thehans/funcutils/blob/master/README.md Demonstrates the usage of is_nan, has_nan, has_function, and is_range by iterating through various data types and printing results. ```OpenSCAD for ( x=[undef,1/0,-1/0,0/0,[],[1,2,3],[1,0/0,2],[1,function(x)x,2],[1,function(x)x,0/0,2], "hi!","",function(x)x,true,false,0,1,-1,[0:-10],[0:1:10],[0:0:0],[0:1:2]] ) { if (is_nan(x)) echo(str("is_nan(",x,") = true")); if (has_nan(x)) echo(str("has_nan(",x,") = true")); if (has_function(x)) echo(str("has_function(",x,") = true")); if (is_range(x)) echo(str("is_range(",x,") = true")); } ``` -------------------------------- ### uninitialized_default_construct_n Source: https://github.com/thehans/funcutils/blob/master/std_algorithm_status.md Constructs objects by default-initialization in an uninitialized area of memory, defined by a start and a count. ```APIDOC ## uninitialized_default_construct_n ### Description Constructs objects by default-initialization in an uninitialized area of memory, defined by a start and a count. ### Parameters (Specific parameters not detailed in source) ### Request Example (Not provided in source) ### Response (Not provided in source) ``` -------------------------------- ### Insert Vector into Sorted Vector Source: https://github.com/thehans/funcutils/blob/master/README.md Demonstrates inserting a vector of elements into an already sorted vector while maintaining the sort order. The second example shows inserting a large, randomly generated vector into an empty vector. ```openscad echo(insertv_sorted([1,2,3,5,5,8,12],[6,4,7,-8,4,3,5,-6,5,3,2,1,10,0,-1])); echo(insertv_sorted([],[for (x=rands(0,10000,10000)) floor(x)])); ``` -------------------------------- ### uninitialized_fill_n Source: https://github.com/thehans/funcutils/blob/master/std_algorithm_status.md Copies an object to an uninitialized area of memory, defined by a start and a count. ```APIDOC ## uninitialized_fill_n ### Description Copies an object to an uninitialized area of memory, defined by a start and a count. ### Parameters (Specific parameters not detailed in source) ### Request Example (Not provided in source) ### Response (Not provided in source) ``` -------------------------------- ### uninitialized_value_construct_n Source: https://github.com/thehans/funcutils/blob/master/std_algorithm_status.md Constructs objects by value-initialization in an uninitialized area of memory, defined by a start and a count. ```APIDOC ## uninitialized_value_construct_n ### Description Constructs objects by value-initialization in an uninitialized area of memory, defined by a start and a count. ### Parameters (Specific parameters not detailed in source) ### Request Example (Not provided in source) ### Response (Not provided in source) ``` -------------------------------- ### Custom Comparison for Min/Max Operations Source: https://github.com/thehans/funcutils/blob/master/README.md Demonstrates using custom comparators with min, max, min_element, and max_element functions. The comparator determines the ordering logic, and for min/max, the first element is returned if values are equivalent. ```javascript echo(max([100,1],[-100,2],function(a,b) a[0] b`, using the provided comparator. ### Parameters - **a**: The first value. - **b**: The second value. - **cmp**: Optional comparator function. Defaults to `lt` (less than). ### Example ``` lencmp = function (a,b) len(a) < len(b); echo(minmax("World!","Hello",lencmp)); // ["Hello", "World!"] // [a,b] stay in-order when equivalent echo(minmax("Hello","World",lencmp)); // ["Hello", "World"] ``` ``` ```APIDOC ## minmax_element (v, first=0, last, cmp=lt) ### Description Returns a pair of indices `[i, j]` where `v[i]` is the minimum element and `v[j]` is the maximum element in the range `[first, last)`. Returns `[last, last]` if the range is empty. If multiple elements are equivalent to the minimum, the first such index is returned for `i`. If multiple elements are equivalent to the maximum, the last such index is returned for `j`. ### Parameters - **v**: The collection to search within. - **first**: The starting index of the range (inclusive). Defaults to 0. - **last**: The ending index of the range (exclusive). - **cmp**: Optional comparator function. Defaults to `lt` (less than). ### Example ``` s = "The quick brown fox jumps over the lazy dog"; x = minmax_element(s); echo(x,s[x[0]],s[x[1]]); // [3, 37], " ", "z" ``` ``` ```APIDOC ## clamp(x, lo, hi, cmp=lt) ### Description Returns `lo` if `x` is less than `lo`, or `hi` if `hi` is less than `x`, otherwise returns `x`. Uses a customizable comparator. ### Parameters - **x**: The value to clamp. - **lo**: The lower bound. - **hi**: The upper bound. - **cmp**: Optional comparator function. Defaults to `lt` (less than). ### Example ``` // Assuming 'lt' is the default comparator echo(clamp(5, 0, 10)); // 5 echo(clamp(-5, 0, 10)); // 0 echo(clamp(15, 0, 10)); // 10 ``` ``` -------------------------------- ### Partition a sequence stably Source: https://github.com/thehans/funcutils/blob/master/README.md Reorders elements such that all elements satisfying a predicate precede those that do not, while preserving the relative order of elements within each partition. ```javascript is_even = function(x)x%2==0; echo(stable_partition([0,1,2,3,4,5,6,7,8,9],p=is_even)); ``` -------------------------------- ### Using Filter with a Function Literal Source: https://github.com/thehans/funcutils/blob/master/README.md Demonstrates how to use the 'filter' function with an anonymous function literal to process a list. Ensure you are using OpenSCAD 2021.01 or later. ```OpenSCAD echo(filter([1,[],2,3,4,5,undef,"no"], function(x) is_num(x))); // result: [1,2,3,4,5] ``` -------------------------------- ### Finding Min/Max Element Indices in a Range Source: https://github.com/thehans/funcutils/blob/master/README.md Illustrates how to find the index of the minimum or maximum element within a specified range of an array. If no range is provided, the entire array is considered. The functions return the index of the first minimum or last maximum element if duplicates exist. ```javascript v= [0,1,2,3,4,5,6,7,8,9,8,7,6,5,4,3,2,1,0,9]; echo(min_element(v)); // 0 echo(min_element(v,10)); // 18 echo(max_element(v)); // 9 echo(max_element(v,10)); // 19 ``` -------------------------------- ### upper_bound, lower_bound, and binary_search Source: https://github.com/thehans/funcutils/blob/master/README.md Performs binary search operations on sorted ranges. `upper_bound` finds the first element greater than a value, `lower_bound` finds the first element not less than a value, and `binary_search` checks for the presence of a value. ```APIDOC ## upper_bound(v, value, first=0, last=undef, cmp=lt) ### Description Returns the index of the first element in the range `[first,last)` which is greater than `value`. ### Method upper_bound ### Parameters #### Path Parameters - **v** (list) - The sorted input list. - **value** - The value to search for. - **first** (integer) - The starting index of the range (inclusive). Defaults to 0. - **last** (integer) - The ending index of the range (exclusive). Defaults to undefined (end of list). - **cmp** (function) - The comparison function. Defaults to less than (lt). ## lower_bound(v, value, first=0, last=undef, cmp=lt) ### Description Returns the index of the first element in the range `[first,last)` which is *not less* than `value`. ### Method lower_bound ### Parameters #### Path Parameters - **v** (list) - The sorted input list. - **value** - The value to search for. - **first** (integer) - The starting index of the range (inclusive). Defaults to 0. - **last** (integer) - The ending index of the range (exclusive). Defaults to undefined (end of list). - **cmp** (function) - The comparison function. Defaults to less than (lt). ## binary_search(v, value, first=0, last=undef, cmp=lt) ### Description Returns `true` if the range `[first,last)` contains `value`, otherwise `false`. ### Method binary_search ### Parameters #### Path Parameters - **v** (list) - The sorted input list. - **value** - The value to search for. - **first** (integer) - The starting index of the range (inclusive). Defaults to 0. - **last** (integer) - The ending index of the range (exclusive). Defaults to undefined (end of list). - **cmp** (function) - The comparison function. Defaults to less than (lt). ### Request Example ``` v = [1, 1, 2, 3, 3, 3, 3, 4, 4, 4, 5, 5, 6]; echo(sublist(v,lower_bound(v,4),upper_bound(v,4))); echo(binary_search([1,2,3,5,5,8,12],3)); ``` ``` -------------------------------- ### destroy_at Source: https://github.com/thehans/funcutils/blob/master/std_algorithm_status.md Destroys an object at a given address. ```APIDOC ## destroy_at ### Description Destroys an object at a given address. ### Parameters (Specific parameters not detailed in source) ### Request Example (Not provided in source) ### Response (Not provided in source) ``` -------------------------------- ### Binary search operations on sorted ranges Source: https://github.com/thehans/funcutils/blob/master/README.md Provides functions for binary search on sorted ranges, including finding the upper and lower bounds of a value and checking for the existence of a value. ```javascript v = [1, 1, 2, 3, 3, 3, 3, 4, 4, 4, 5, 5, 6]; echo(sublist(v,lower_bound(v,4),upper_bound(v,4))); ``` ```javascript echo(binary_search([1,2,3,5,5,8,12],3)); ``` -------------------------------- ### Find first mismatch between two vectors Source: https://github.com/thehans/funcutils/blob/master/README.md Compares two vectors element by element within specified ranges and returns a pair of indices indicating the first mismatch. If no mismatches are found up to the end of the shorter range, it returns the end index of the shorter range and the corresponding index from the other range. ```openscad echo(mismatch(v1="oh! hi, how are you?",first1=4,v2="hi, how's it going?"));// [11, 7] echo(mismatch(v1="Hello World",v2="Hello World"));// [11, 11] echo(mismatch(v1="Hello!",v2="Hello")); // [5, 5] echo(mismatch(v1="l",v2="Hello",first2=3)); // [1, 4] ``` -------------------------------- ### Accumulate Operation with Custom Operator Source: https://github.com/thehans/funcutils/blob/master/README.md Demonstrates the accumulate function, which is similar to a fold operation. It can perform operations like summation or multiplication over a range, with optional initial values and custom operators. ```javascript echo(accumulate([1,2,3,4,5])); echo(accumulate([1,2,3,4,5],init=1,op=function(x,y)x*y)); ``` -------------------------------- ### Min/Max Pair Operations with Custom Comparator Source: https://github.com/thehans/funcutils/blob/master/README.md Shows the usage of minmax and minmax_element with a custom comparator. The minmax function returns a pair ordered by the comparator, preserving order for equivalent elements. minmax_element finds the indices of the minimum and maximum elements in a range. ```javascript lencmp = function (a,b) len(a) < len(b); echo(minmax("World!","Hello",lencmp)); // ["Hello", "World!"] echo(minmax("Hello","World!",lencmp)); // ["Hello", "World!"] // [a,b] stay in-order when equivalent echo(minmax("Hello","World",lencmp)); // ["Hello", "World"] echo(minmax("world","Hello",lencmp)); // ["World", "Hello"] s = "The quick brown fox jumps over the lazy dog"; x = minmax_element(s); echo(x,s[x[0]],s[x[1]]); // [3, 37], " ", "z" ``` -------------------------------- ### uninitialized_copy_n Source: https://github.com/thehans/funcutils/blob/master/std_algorithm_status.md Copies a specified number of objects to an uninitialized area of memory. ```APIDOC ## uninitialized_copy_n ### Description Copies a specified number of objects to an uninitialized area of memory. ### Parameters (Specific parameters not detailed in source) ### Request Example (Not provided in source) ### Response (Not provided in source) ``` -------------------------------- ### uninitialized_copy Source: https://github.com/thehans/funcutils/blob/master/std_algorithm_status.md Copies a range of objects to an uninitialized area of memory. ```APIDOC ## uninitialized_copy ### Description Copies a range of objects to an uninitialized area of memory. ### Parameters (Specific parameters not detailed in source) ### Request Example (Not provided in source) ### Response (Not provided in source) ``` -------------------------------- ### uninitialized_fill Source: https://github.com/thehans/funcutils/blob/master/std_algorithm_status.md Copies an object to an uninitialized area of memory, defined by a range. ```APIDOC ## uninitialized_fill ### Description Copies an object to an uninitialized area of memory, defined by a range. ### Parameters (Specific parameters not detailed in source) ### Request Example (Not provided in source) ### Response (Not provided in source) ``` -------------------------------- ### replace and replace_if Source: https://github.com/thehans/funcutils/blob/master/README.md Replaces elements in a sequence. `replace` replaces all occurrences of an old value with a new value, while `replace_if` replaces elements matching a predicate. ```APIDOC ## replace(v, old_value, new_value, first=0, last, cmp=eq) ### Description Replaces all elements in the range `[first, last)` that are equivalent to `old_value` with `new_value`. ### Method replace ### Parameters #### Path Parameters - **v** (list) - The input list. - **old_value** - The value to be replaced. - **new_value** - The value to replace with. - **first** (integer) - The starting index of the range (inclusive). Defaults to 0. - **last** (integer) - The ending index of the range (exclusive). Defaults to the end of the list. - **cmp** (function) - The comparison function. Defaults to equality (eq). ### Request Example ``` echo(replace([0,1,2,3,1,4,5,6,1,7,8,1,9],1,[])); ``` ## replace_if(v, new_value, first=0, last, p) ### Description Replaces all elements in the range `[first, last)` for which the predicate `p` returns `true`, with `new_value`. ### Method replace_if ### Parameters #### Path Parameters - **v** (list) - The input list. - **new_value** - The value to replace with. - **first** (integer) - The starting index of the range (inclusive). Defaults to 0. - **last** (integer) - The ending index of the range (exclusive). Defaults to the end of the list. - **p** (function) - The predicate function that returns true for elements to be replaced. ### Request Example ``` echo(replace_if([0,1,2,3,1,4,5,6,1,7,8,1,9],0,p=function(x)x<5)); ``` ``` -------------------------------- ### remove and remove_if Source: https://github.com/thehans/funcutils/blob/master/README.md Removes elements from a sequence. `remove` removes a range of elements, while `remove_if` removes elements matching a predicate. ```APIDOC ## remove(v, first=0, last) ### Description Removes a range of elements [first,last) from a list. ### Method remove ### Parameters #### Path Parameters - **v** (list) - The input list. - **first** (integer) - The starting index of the range (inclusive). Defaults to 0. - **last** (integer) - The ending index of the range (exclusive). Defaults to the end of the list. ### Request Example ``` echo(remove([0,1,2,3,4,5,6,7,8,9],3,7)); echo(remove([0,1,2,3,4,5,6,7,8,9])); ``` ## remove_if(v, first=0, last, p) ### Description Removes elements from a range that match a given predicate. ### Method remove_if ### Parameters #### Path Parameters - **v** (list) - The input list. - **first** (integer) - The starting index of the range (inclusive). Defaults to 0. - **last** (integer) - The ending index of the range (exclusive). Defaults to the end of the list. - **p** (function) - The predicate function that returns true for elements to be removed. ### Request Example ``` echo(remove_if([0,1,2,3,4,5,6,7,8,9],p=function(x)x%3==0)); ``` ``` -------------------------------- ### reverse Source: https://github.com/thehans/funcutils/blob/master/README.md Reverses a specified range of elements within a sequence. ```APIDOC ## reverse(v, first=0, last) ### Description Reverses a range of elements within a sequence. ### Method reverse ### Parameters #### Path Parameters - **v** (list) - The input list. - **first** (integer) - The starting index of the range (inclusive). Defaults to 0. - **last** (integer) - The ending index of the range (exclusive). Defaults to the end of the list. ### Request Example ``` echo(reverse([0,1,2,3,4,5,6,7,8,9])); echo(reverse([0,1,2,3,4,5,6,7,8,9],3,7)); ``` ``` -------------------------------- ### uninitialized_value_construct Source: https://github.com/thehans/funcutils/blob/master/std_algorithm_status.md Constructs objects by value-initialization in an uninitialized area of memory, defined by a range. ```APIDOC ## uninitialized_value_construct ### Description Constructs objects by value-initialization in an uninitialized area of memory, defined by a range. ### Parameters (Specific parameters not detailed in source) ### Request Example (Not provided in source) ### Response (Not provided in source) ``` -------------------------------- ### uninitialized_move Source: https://github.com/thehans/funcutils/blob/master/std_algorithm_status.md Moves a range of objects to an uninitialized area of memory. ```APIDOC ## uninitialized_move ### Description Moves a range of objects to an uninitialized area of memory. ### Parameters (Specific parameters not detailed in source) ### Request Example (Not provided in source) ### Response (Not provided in source) ``` -------------------------------- ### Count elements with count and count_if Source: https://github.com/thehans/funcutils/blob/master/README.md Counts the occurrences of a specific value or elements satisfying a predicate within a given range of a vector. `count` takes a value to match, while `count_if` takes a predicate function `p`. ```openscad echo(count("this is a test","t")); echo(count_if([1,2,3,4,5,6,7,8,9,10],p=function(x)x>3)); ``` -------------------------------- ### destroy_n Source: https://github.com/thehans/funcutils/blob/master/std_algorithm_status.md Destroys a specified number of objects in a range. ```APIDOC ## destroy_n ### Description Destroys a specified number of objects in a range. ### Parameters (Specific parameters not detailed in source) ### Request Example (Not provided in source) ### Response (Not provided in source) ``` -------------------------------- ### destroy Source: https://github.com/thehans/funcutils/blob/master/std_algorithm_status.md Destroys a range of objects. ```APIDOC ## destroy ### Description Destroys a range of objects. ### Parameters (Specific parameters not detailed in source) ### Request Example (Not provided in source) ### Response (Not provided in source) ``` -------------------------------- ### Find element in vector using std::find Source: https://github.com/thehans/funcutils/blob/master/README.md Finds the index of the first element in a vector equivalent to a given value within a specified range. Returns the end index if the value is not found. Defaults to searching the entire vector if 'first' and 'last' are omitted. ```openscad v=[6,4,7,-8,4,3,5,-6,5,3,2,1,10,0,-1]; echo(find(v,-8)); echo(find(v,-1)); echo(find(v,undef)); echo(find([0],0)); echo(find([0],1)); echo(find([],undef)); ``` -------------------------------- ### uninitialized_move_n Source: https://github.com/thehans/funcutils/blob/master/std_algorithm_status.md Moves a specified number of objects to an uninitialized area of memory. ```APIDOC ## uninitialized_move_n ### Description Moves a specified number of objects to an uninitialized area of memory. ### Parameters (Specific parameters not detailed in source) ### Request Example (Not provided in source) ### Response (Not provided in source) ``` -------------------------------- ### std_rotate Source: https://github.com/thehans/funcutils/blob/master/README.md Reorders elements in a range by moving a sub-range to the beginning and the preceding sub-range to the end. ```APIDOC ## std_rotate(v, first=0, first_n, last) ### Description Reorders elements in the range `[first,last)` such that the sub-range `[first_n, last)` moves to the beginning of the range, and the sub-range `[first, first_n)` moves to the end of the range. ### Method std_rotate ### Parameters #### Path Parameters - **v** (list) - The input list. - **first** (integer) - The starting index of the range (inclusive). Defaults to 0. - **first_n** (integer) - The index marking the beginning of the sub-range to be moved to the front. - **last** (integer) - The ending index of the range (exclusive). Defaults to the end of the list. ### Request Example ``` // move elements [3,7) to position 12: https://www.youtube.com/watch?v=W2tWOdzgXHA&feature=youtu.be&t=630 echo(std_rotate([0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15],3,7,12)); // move elements [8,12) to position 3: https://www.youtube.com/watch?v=W2tWOdzgXHA&feature=youtu.be&t=645 echo(std_rotate([0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15],3,8,12)); ``` ``` -------------------------------- ### Replace elements in a sequence Source: https://github.com/thehans/funcutils/blob/master/README.md Replaces elements that match a specific value or a predicate with a new value. Use `replace` for value-based replacement and `replace_if` for predicate-based replacement. ```javascript echo(replace([0,1,2,3,1,4,5,6,1,7,8,1,9],1,[])); ``` ```javascript echo(replace_if([0,1,2,3,1,4,5,6,1,7,8,1,9],0,p=function(x)x<5)); ``` -------------------------------- ### stable_partition Source: https://github.com/thehans/funcutils/blob/master/README.md Reorders elements in a range such that elements satisfying a predicate precede those that do not, preserving relative order. ```APIDOC ## stable_partition(v, first=0, last, p) ### Description Reorders the elements in the range `[first, last)` such that all elements for which the predicate `p` returns `true` precede the elements for which predicate `p` returns `false`. The relative order of the elements is preserved. ### Method stable_partition ### Parameters #### Path Parameters - **v** (list) - The input list. - **first** (integer) - The starting index of the range (inclusive). Defaults to 0. - **last** (integer) - The ending index of the range (exclusive). Defaults to the end of the list. - **p** (function) - The predicate function. ### Request Example ``` is_even = function(x)x%2==0; echo(stable_partition([0,1,2,3,4,5,6,7,8,9],p=is_even)); ``` ``` -------------------------------- ### Check for element existence with contains Source: https://github.com/thehans/funcutils/blob/master/README.md Determines if any element within a specified range of a vector is equivalent to a given value. Returns true if a match is found, false otherwise. This is a boolean variation of `std::find`. ```openscad echo(contains([6,4,7,-8,4,3,5,-6,5,3,2,1,10,0,-1],3.14)); echo(contains([6,4,7,-8,4,3,5,-6,5,3,2,1,10,0,-1],-1)); ``` -------------------------------- ### Rotate elements in a sequence Source: https://github.com/thehans/funcutils/blob/master/README.md Reorders elements in a range such that a sub-range moves to the beginning and the preceding sub-range moves to the end. Useful for circular shifts. ```javascript // move elements [3,7) to position 12: https://www.youtube.com/watch?v=W2tWOdzgXHA&feature=youtu.be&t=630 echo(std_rotate([0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15],3,7,12)); ``` ```javascript // move elements [8,12) to position 3: https://www.youtube.com/watch?v=W2tWOdzgXHA&feature=youtu.be&t=645 echo(std_rotate([0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15],3,8,12)); ``` -------------------------------- ### Reverse a range of elements in a sequence Source: https://github.com/thehans/funcutils/blob/master/README.md Reverses the order of elements within a specified range of a sequence. Can reverse the entire sequence or a sub-range. ```javascript echo(reverse([0,1,2,3,4,5,6,7,8,9])); ``` ```javascript echo(reverse([0,1,2,3,4,5,6,7,8,9],3,7)); ``` -------------------------------- ### Numeric Operations Source: https://github.com/thehans/funcutils/blob/master/README.md Functions for performing numeric computations, such as accumulation (folding) over a range. ```APIDOC ## accumulate (v, first=0, last=undef, init=0, op=add) ### Description Performs an accumulation (fold) operation over a range of a collection. It takes an initial value and an optional operation (defaults to addition). ### Parameters - **v**: The collection to accumulate over. - **first**: The starting index of the range (inclusive). Defaults to 0. - **last**: The ending index of the range (exclusive). Defaults to `undef` (end of collection). - **init**: The initial value for the accumulation. Defaults to 0. - **op**: The binary operation to apply. Defaults to `add` (addition). ### Example ``` echo(accumulate([1,2,3,4,5])); echo(accumulate([1,2,3,4,5],init=1,op=function(x,y)x*y)); ``` ``` -------------------------------- ### unique Source: https://github.com/thehans/funcutils/blob/master/README.md Removes consecutive duplicate elements from a sorted range. ```APIDOC ## unique(v, first=0, last, cmp=eq) ### Description Removes all but the first element from every group of consecutive equivalent elements in the range `[first,last)`. The input vector `v` should be pre-sorted if uniqueness across the entire vector is desired. ### Method unique ### Parameters #### Path Parameters - **v** (list) - The input list. - **first** (integer) - The starting index of the range (inclusive). Defaults to 0. - **last** (integer) - The ending index of the range (exclusive). Defaults to the end of the list. - **cmp** (function) - The comparison function for equivalence. Defaults to equality (eq). ### Request Example ``` echo(unique(insertv_sorted([],[1,2,3,1,2,3,3,4,5,4,5,6,7]))); ``` ``` -------------------------------- ### Remove elements from a sequence Source: https://github.com/thehans/funcutils/blob/master/README.md Removes elements within a specified range or based on a predicate. Use `remove` for range-based removal and `remove_if` for predicate-based removal. ```javascript echo(remove([0,1,2,3,4,5,6,7,8,9],3,7)); ``` ```javascript echo(remove([0,1,2,3,4,5,6,7,8,9])); ``` ```javascript echo(remove_if([0,1,2,3,4,5,6,7,8,9],p=function(x)x%3==0)); ``` -------------------------------- ### Remove consecutive duplicates from a sorted sequence Source: https://github.com/thehans/funcutils/blob/master/README.md Removes all but the first element from groups of consecutive equivalent elements. The input sequence should be pre-sorted for uniqueness across the entire vector. ```javascript echo(unique(insertv_sorted([],[1,2,3,1,2,3,3,4,5,4,5,6,7]))); ``` === COMPLETE CONTENT === This response contains all available snippets from this library. No additional content exists. Do not make further requests.