Splits a slice into two based on a predicate function. It starts appending to the second slice after the first element that matches the predicate. All elements after the first match are included in the second slice, regardless of whether they match the predicate or not.
AcceptIf returns another function of the same signature as the apply function but also includes a bool value to indicate success or failure.
A predicate function that takes an argument of type T and returns a bool.
An apply function that also takes an argument of type T and returns a modified value of the same type.
* Strutil: HammingDistance func
The Hamming distance is the number of positions at which the corresponding symbols are different
* Add hamming distance doc
Feature
Reset allows for the iteration process over a sequence to be restarted from the beginning.
It enables reusing the iterator for multiple traversals without needing to recreate it.
Refactoring
It is a idiomatic practice to design functions and methods to return concrete struct types.
This approach promotes flexibility and decoupling, allowing the calling code to work with any implementation that satisfies the interface
SetToDefaultIf sets elements to their zero value if they match the given predicate.
It retains the positions of the elements in the slice.
It returns slice of T and the count of modified slice items
The FilterByValue function is a method defined on the HashMap type. It generates a new HashMap
containing only the elements that satisfy a specified condition,
as determined by a predicate function applied to each element's value.
Note: Will add later doc
Add new function, NAND, designed to create a composed predicate representing the logical NAND operation
applied to a list of predicates. The NAND operation is a logical operation
that returns true only if all perdicate result in false otherwise false
Add new function, Xnor, designed to create a composed predicate representing
the logical Exclusive NOR (XNOR) operation applied to a list of predicates.
The XNOR operation is a logical operation that returns true only
if all operands have the same boolean value
* Add exponential With jitter backoff
Adds exponential + jitter retry policy. To enable drastic slow down of sending out requests to any external system.
Jitter in computational contexts refers to the addition of a small random variation to a value
to break the symmetric patterns
* Retry with exp: Allow shift for all multiple of 2
The aim of this policy is to enable the configuration of various types of backoff mathematical curves. Should this modification be deemed suitable,
I will proceed to implement an exponential curve backoff policy and set of custom backoff policy
Warning: It's major break
* LastIndexOfFunc returns the index of the last occurrence of the value in this list satisfying f(data[i])
* IndexOfFunc returns the first index satisfying f(v)
* Slice: reverse and shufffle v2
Migrate from reflection to generic form
Note: after migration, old reverse must be removed
* Suffle test: remove reflection calls
* Reverse test: change name of test
The current behavior can result into wired edge cases.
**Current behavior**
if find was unsuccessfully then it will return the first element of the
slice
**Desired behavior**
if find was unsuccessfully then it should return negative ok and a none
value
Group by: split slice into two groups, applies on each slice element a
predicate func to categorize this element.
Changes
* Add groub by func
* Add test case for this func
IntSlice and StringSlice: preallocate memory up front for output slice.
Instead returning a error throw a panic because most likely it's a
programming error.
Contain: rename slice to iterableType and add default case for type
mismatches
* Use unicode.ToUpper func to convert first letter in string to upper case
letter.
* Preallocate memory with correct length and cap because the final
string is not changing.