getArray()
getArray() : array
Get the Set as Array
Return the set contents as an array
Returns
array —The set represented as an array
Set Interface - Defines A Set Data Structure
A set is a collection of values that are unique. In mathematical terms it is an implementation of a finite set. Usually you test if something exists or doesn't exist inside the set. You can also set up operations on sets themselves, much like an array map. You can also easily perform unions, intersections, and many operations traditional to set theory and the set data type.
retrieveReference(mixed $identifier) : \Phabstractic\Data\Types\Resource\mixed;
If the value is in the set, this retrieves a reference to it
This only works if the set is considered unique
mixed | $identifier | The identifier returned by the add function |
equal(\Phabstractic\Data\Types\Resource\SetInterface $S1, \Phabstractic\Data\Types\Resource\SetInterface $S2) : boolean
Is S1 Equal to S2?
\Phabstractic\Data\Types\Resource\SetInterface | $S1 | |
\Phabstractic\Data\Types\Resource\SetInterface | $S2 |
fold(callable $F, \Phabstractic\Data\Types\Resource\Set $S) : mixed
Apply a function to each element of the set, reducing to a single function
"returns the value A|S| after applying Ai+1 := F(Ai, e) for each element e of S."
callable | $F | The applicable function. |
\Phabstractic\Data\Types\Resource\Set | $S | The Set to fold |
The value resulting from the 'fold' (array_reduce)
filter(callable $F, \Phabstractic\Data\Types\Resource\Set $S) : array
Returns only elements that satisfy a 'predicate'
The predicate here is a function that returns true or false on any given item "returns the subset containing all elements of S that satisfy a given predicate P."
callable | $F | The applicable predicate function. |
\Phabstractic\Data\Types\Resource\Set | $S | The Set to filter |
The filtered aray
map(callable $F, \Phabstractic\Data\Types\Resource\Set $S) : array
Apply a function to each element of the set
"returns the set of distinct values resulting from applying function F to each element of S."
callable | $F | The applicable function. |
\Phabstractic\Data\Types\Resource\Set | $S | The Set to map |
The resulting distinct set
walk(\Phabstractic\Data\Types\Resource\SetInterface $S, callable $F, mixed $D) : boolean
Applies the given function, plus any additional arguments ($args) past the given function argument to each element of theset.
Note: Unlike Map, this operates on a reference of the set
\Phabstractic\Data\Types\Resource\SetInterface | $S | |
callable | $F | the applicablt function |
mixed | $D | the user data |
True on Success, False otherwise
build(array $values = array()) : \Phabstractic\Data\Types\Resource\Set
Create a set from an array
Just hands back a Set created from a given array "creates a set structure with values x1,x2,…,xn."
array | $values | The values of the set (which are 'uniqued' in the construction) |
subset(\Phabstractic\Data\Types\Resource\Set $S, \Phabstractic\Data\Types\Resource\Set $T) : boolean
Set Filter
"a predicate that tests whether the set S is a subset of set T."
This function tests whether all elements of S are in T
\Phabstractic\Data\Types\Resource\Set | $S | The first set |
\Phabstractic\Data\Types\Resource\Set | $T | The comparison/parent set |