On Fri, 10 Feb 2012 18:20:43 -0500, Barry Margolin wrote:
> In article <jh3v8h$at3$
1...@dont-email.me>, zermelo <zer...@invalid.spam>
> wrote:
>
>> On Fri, 10 Feb 2012 10:59:47 -0800, namekuseijin wrote:
>>
>> > On Feb 10, 4:44 pm, Alex Mizrahi <
alex.mizr...@gmail.com> wrote:
>> >> > I have to do a work in php, but I would like to write functional
>> >> > code as much as possible.
>> >>
>> >> Why? It doesn't make any sense.
>> >>
>> >> And what is 'functional code'? Some people think that it is about
>> >> high-order functions, while others -- lack of side effects,
>> >> immutable data.
>> >>
>> >> It doesn't make any sense to write functional code if you don't know
>> >> what it is and why you need it.
>> >
>> >
>> For functional code, I mean closures, map, filter, reduce and similar
>> Lisp-like functions. I have searched the official documentation, but I
>> don't see them. Maybe there exists some external library...any help?
>
> PHP has all of those things.
>
> lambda = create_function
> mapcar = array_map
> filter = array_filter
> reduce = array_reduce
> funcall = Assign funcname to variable, then $variable(<args>)