Skip to content

Repository files navigation

Parallel

Build StatusScrutinizer Code QualityCode CoverageAverage time to resolve an issuePercentage of issues still openChat on Gitter

Parallel implementation of the higher-order functions map, filter and fold using the phtreads library. This way the computation is distributed across multiple threads so that the whole computational power of the computer can be used.

See the pthreads library requirement. If you are not sure they will be satisfied, install the polyfill.

Installation

composer require functional-php/parallel

Basic Usage

useFunctionalPHP\Parallelasp;
p\map(4, function($i) { return$i + 2; }, [1, 2, 3, 4]);
// will return [3, 4, 5, 6]p\filter(4, function($i) { return$i % 2 == 0; }, [1, 2, 3, 4]);
// will return [2, 4]p\fold(4, function($a, $b) { return$a + $b; }, [1, 2, 3, 4], 0);
// will return 10

Testing

You can run the test suite for the library using:

composer test

A test report will be available in the reports directory.

Contributing

Any contribution welcome :

  • Ideas
  • Pull requests
  • Issues

About

Parallel implementation of the higher-order functions map, filter and fold

Resources

Stars

6 stars

Watchers

1 watching

Forks

Releases

Packages

Contributors

Languages