Skip to content

A set of functionally useful functions for functional functional programming in PHP.

License

Notifications You must be signed in to change notification settings

Burgestrand/Funcy

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

11 Commits
 
 
 
 
 
 
 
 

Repository files navigation

What is Funcy?

I (the developer) am a big fan of functional programming. It has had a big — positive — impact on all I do. I also am a big fan of scripting languages such as Ruby, Python and PHP. PHP has closures (anonymous functions) as of 5.3, but no equivalents for powerful functions from functional languages such as currying, function composition etc.

Funcy brings all the functioning functional funkyness to PHP. Awesome!

What’s missing in PHP?

  • partially applying functions

      add(a, b): a + b
      add_five: add(5)
      
      print add_five(10) // 15
    
  • composing functions

      add(a, b): a + b
      square(x): x * x
      squad(a, b): compose(square, add)
      
      print squad(2, 3) // ((2 + 3) * (2 + 3)) = 25!
    
  • map, reduce (fold)

    There are array_map and array_reduce in PHP already, but they only work for arrays. I want something that works for all traversable things, be they arrays or objects.

License?

See LICENSE.

About

A set of functionally useful functions for functional functional programming in PHP.

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages