The old page is below.
Functional PHP Extensions
A set of higher-order functions and other primatives written in PHP4 which let you write php code in a functional style, similar to the way you might in Haskell, Scheme, or ML. There are also stubby object-to-functional bindings. | |
|
|
Documentation:It's literate (or at least heavily commented) source code. Read it, and you will learn a lot about PHP and how the library works.Alternatively, grep for the word "function". I've tried to keep it to where only the lambda function actually includes the word "function" in the body of the function. Ok, so you're impatient. Here are a few highlights:
Objects?Ok, so you call methods on objects to get results, right? Almost the same as a function except that:
So anyway, the whole point here becomes one of determining which types of interactions are both common with objects and representative of standard fundamental intentions. What I've observed about functional programming is the idea that you have collections of stuff that basically similar composite operations happen to. That is, it's largely focused on lists (and in PHP's case, hashes). By this line of reasoning, it seems that the main thrust of an integration would be a way to perform list (or hash) based operations with or on objects. Such operations would, of course, be composable functions. Right now, we have a map_method function, which encapsulates a loop around sending a list of things into a unary method. This basically allows objects to operate as closures. There are some more common patterns of interaction with objects, but right this minute I haven't taken the time to enumerate them. Anyone with extensive experienece is welcome to make suggestions or send me code. |