2017 © Pedro Peláez
 

library partial

Function partial application

image

simones/partial

Function partial application

  • Sunday, September 18, 2016
  • by SimoneS
  • Repository
  • 1 Watchers
  • 2 Stars
  • 8 Installations
  • PHP
  • 0 Dependents
  • 0 Suggesters
  • 0 Forks
  • 0 Open issues
  • 2 Versions
  • 0 % Grown

The README.md

Build Status, (*1)

Apply partial arguments to your functions., (*2)

Install

$ composer require simones/partial

Usage

Bind a subset of a function's arguments and get a new function back that accepts the remaining arguments. It is most useful if you write functional programming or don't like using use with anonymous functions. You can get a Partial instance via instantiation or with the partial helper., (*3)

Here are some examples (for more, head to the spec):, (*4)

// one-argument binding
$hello = partial('printf', ['Hello, %s']);
$hello('world') // print "Hello, world"
// or
$hello->call('world')


// multiple arguments binding
$countdown = partial('printf', ['%s, %s, %s, go!', 'Three']);
$countdown('Two', 'One'); // print "Three, Two, One, go!"


// you can skip argument, and they will be filled on call time
$countdown = partial('printf', ['%s, %s, %s, go!', Partial::SKIP, 'Two']);
$countdown('Trhee', 'One'); // print "Three, Two, One, go!"

The Versions

18/09 2016

dev-master

9999999-dev

Function partial application

  Sources   Download

MIT

The Requires

  • php >=5.5.0

 

The Development Requires

by Simone Salerno

17/09 2016

1.0.0

1.0.0.0

Function partial application

  Sources   Download

MIT

The Requires

  • php >=5.5.0

 

The Development Requires

by Simone Salerno