Arrays: added functional API - #36
Closed
JanTvrdik wants to merge 1 commit into
Closed
Conversation
Contributor
|
Nice methods. I think we should revisit the idea of wrapping the scalars/arrays in objects. |
Contributor
Author
That makes very little sense if not supported by language. Wait for PHP 7. |
dg
force-pushed
the
master
branch
2 times, most recently
from
May 21, 2015 11:51
5617d88 to
209844d
Compare
dg
force-pushed
the
master
branch
2 times, most recently
from
June 19, 2015 12:53
5ed86bc to
509ef5e
Compare
dg
force-pushed
the
master
branch
13 times, most recently
from
September 9, 2015 07:16
6c03b1f to
a4bddc8
Compare
dg
force-pushed
the
master
branch
3 times, most recently
from
September 28, 2015 14:20
2998062 to
f6303c6
Compare
Member
|
Now it (i.e. class Iterators
{
public static function map($iterator, callable $callback)
{
foreach ($iterator as $key => $value) {
yield $key => $callback($value);
}
}
public static function filter($iterator, callable $callback)
{
foreach ($iterator as $key => $value) {
if ($callback($value)) {
yield $key => $value;
}
}
} |
Contributor
Author
|
Yes. But I would expect |
Contributor
|
@dg Generators are good but I don't think we need functions like this in Nette. Just use nikic/iter. |
dg
force-pushed
the
master
branch
2 times, most recently
from
December 3, 2015 12:21
46f5434 to
ecbbdfc
Compare
dg
force-pushed
the
master
branch
4 times, most recently
from
April 21, 2016 13:00
ae4dce9 to
3d2aa29
Compare
dg
force-pushed
the
master
branch
3 times, most recently
from
September 3, 2016 12:27
c8398ca to
47dc563
Compare
dg
added a commit
that referenced
this pull request
Dec 19, 2016
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
I love those methody in JS, would be nice to have them in PHP as well. What do you think?