Higher Order PHP: Map and Functional Extension Helper |
[eluser]Jamongkad[/eluser]
Thank you for the input! Colin, I'm the first to tell you that the library is still undergoing changes even as we speak. I know my first example is a bit premature, my inspiration for the library comes from this link Higher Order Javascript. Although I'm the first to admit my implementation is weak compared to the examples given. THe reason the syntax may look (weird|unintuitive) is because I'm experimenting with array_map as an alternative means of iteration as opposed to Foreach. I think I should have made my point a bit more clearer when I first posted this library. Truth be known I'm ready to release a new version of the library that concentrates on recursion in place of array_map. Xwero, yes it's more of an enchantment at this point. But please do take in mind how the library structures complexity for you. Code: $this->map->proc('function') <------the function you want to work on Let's not stop there...you can even apply functions as arguments to the target function you chose to work on. Anonymous functions at that! Code: $this->map->proc(lam('$x,$y,$z','$z($x(y)) * $z($x(y))') |
Welcome Guest, Not a member yet? Register Sign In |