Skip to content

Commit 8d0834c

Browse files
committed
Add a What's next section and some new links.
1 parent 261e81f commit 8d0834c

File tree

1 file changed

+26
-5
lines changed

1 file changed

+26
-5
lines changed

content/posts/dev/2020-08-10-lazy-collection-library-oddities.md

Lines changed: 26 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -118,7 +118,7 @@ As you may have noticed, there are multiple times the letter `a`, at index `0` a
118118

119119
The same process is applied for each remaining array values.
120120

121-
From there, we can deduct that:
121+
From there, we can deduce that:
122122

123123
```php
124124
<?php
@@ -128,7 +128,7 @@ $input = ['a', 'b', 'c', 'a', 'd', 'b'];
128128
$filteredWithArrayFlip = array_values(array_flip(array_flip($input)));
129129
$filteredWithArrayUnique = array_unique($input);
130130

131-
// We can deduct that:
131+
// We can deduce that:
132132
// $filteredWithArrayFlip === $filteredWithArrayUnique;
133133
```
134134

@@ -265,8 +265,12 @@ This collection library let you use any kind of type for keys: _scalar_, _object
265265
This library could be a valid replacement for [\SplObjectStorage](https://www.php.net/manual/en/class.splobjectstorage.php)
266266
but with much more features.
267267

268-
This way of working opens up new perspectives, another ways of handling data, different ways to think about data
269-
structure.
268+
To some extent, this way of working opens up new perspectives and new paradigms.
269+
270+
Another ways of handling data, different ways to think about their structure and how to mangle them.
271+
272+
See this particular [thread #31761](https://github.com/laravel/framework/issues/31761) on the Laravel project,
273+
there is also some good information there.
270274

271275
# Oddity #3
272276

@@ -396,7 +400,24 @@ $collection = Collection::fromIterable($input())
396400

397401
By using the `wrap()` operation at the end, we make sure to not lose any values when converting into a regular array.
398402

399-
When you use the `sort()` operation, it relies on the [ArrayIterator::uasort()](https://www.php.net/manual/en/arrayiterator.uasort.php) underneath.
403+
When you use the [`sort()` operation](https://github.com/loophp/collection/blob/master/src/Operation/Sort.php), it relies on the [ArrayIterator::uasort()](https://www.php.net/manual/en/arrayiterator.uasort.php) underneath.
400404
But the `sort()` operation has all the logic to wrap all values prior and then unwrap them once they are sorted.
401405

402406
That was something hard to figure out at first, which in the end seemed completely logic.
407+
408+
# What's next?
409+
410+
Now that I'm acquainted with that non-exhaustive list of oddities, I still have some work to do.
411+
412+
What I'm trying to achieve with [loophp/collection](https://github.com/loophp/collection) is to focus on the algorithms.
413+
414+
[loophp/collection](https://github.com/loophp/collection) contains a list of [Operation](https://github.com/loophp/collection/tree/master/src/Operation) and [Transformation](https://github.com/loophp/collection/tree/master/src/Transformation) classes.
415+
416+
Those classes are basically classes wrapping a function that does something on the original collection.
417+
Operations returns a Generator, Transformation returns usually a simple value.
418+
419+
My todo list for the next major version of the library:
420+
421+
* Get rid of Transformation and use Operation exclusively (_work in progress in [PR #12](https://github.com/loophp/collection/pull/12)_)
422+
* Try to reach a better typing coverage,
423+
* Provide a better documentation with real life examples of use for each Operation.

0 commit comments

Comments
 (0)