Giter VIP home page Giter VIP logo

colada's People

Contributors

alexeyshockov avatar include-x avatar paulchubatyy avatar pborreli avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar

colada's Issues

PHP 5.3 support

  • call_user_func() instead of callable.
  • array() insted of short syntax.
  • object and array dereferencing...

Map::partition()

list($activeUsers, $inactiveUsers) = $users->partition(function($user, $roles) {
    return $user->isActive();
});

Native array backend for Map

For maps, that contains only scalar keys, native array backend will be really better (by comparing to SplObjectStorage).

Collection::groupBy() with unique keys

In use case, where keys are unique, we not need multi map, but simple map.

I think, this may be achieved with something like: Collection::groupBy($keyFinder, $uniqueKeys = false).

Sorted collections

Optimizations and interface for sorted collections.

Interface:

  • sorted set builder,
  • sorted collection builder,
  • sorted map builder.

Thoughts on implementation: collect (as is), sort in build().

Optimizations:

  • binary search (Collection::contains(), Map::containsKey()).

Typed IteratorCollection

For collections with elements of same type some operations can be optimized (where comparison is used).

Matchers

isAnyMatchBy(), isAllMatchBy(), isNoneMatchBy().

Collection::toMap()

Will be useful with zip(), like this:

$keys; // Collection.
$elements; // Collection.

$map = $keys->zip($elements)->toMap();

PairMap::createMapBuilder()

Create builder in one place, like in IteratorCollection.

May be useful with get_class() to produce map with current type.

Excess steps

To exapmle, the following code:

var_dump('GO');
$a = [1,2];
$b = to_collection($a)->mapBy(function($v) {
    var_dump('Map by');

    return $v+1;
});

var_dump($b->count());

... produces the following output:

string(2) "GO"
string(6) "Map by"
string(6) "Map by"
string(6) "Map by"
int(2)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.