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.
moreover, it doesn't make any sense to write in PHP specifically.
It's a dog of a language and barely holds together for ugly imperative
programming, let alone other paradigms...
> > Anyone knows libraries/references where I can look for?
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?
> moreover, it doesn't make any sense to write in PHP specifically. It's a
> dog of a language and barely holds together for ugly imperative
> programming, let alone other paradigms...
>> > Anyone knows libraries/references where I can look for?
zermelo <zerm...@invalid.spam> writes:
> I don't like php, but my boss wants it. So I was guessing whether someone > here had a remedy to alleviate the pain.
PHP 5 even has closures, IIRC. So you can start to apply Greenspun Tenth
Law right now.
On Fri, 10 Feb 2012 21:41:25 +0100, Pascal J. Bourguignon wrote:
> zermelo <zerm...@invalid.spam> writes:
>> I don't like php, but my boss wants it. So I was guessing whether
>> someone here had a remedy to alleviate the pain.
> PHP 5 even has closures, IIRC. So you can start to apply Greenspun
> Tenth Law right now.
Searching Greenspun's law on wikipedia, I discovered the corollary of Robert Morris, who in turn was the creator of the first computer worm and
the partner of Paul Graham of viaweb, who is an ardent advocate of Lisp:)
> 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>)
-- Barry Margolin, bar...@alum.mit.edu
Arlington, MA
*** PLEASE post questions in newsgroups, not directly to me ***
On Fri, 10 Feb 2012 18:20:43 -0500, Barry Margolin wrote:
> In article <jh3v8h$at...@dont-email.me>, zermelo <zerm...@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?
> 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?
>> moreover, it doesn't make any sense to write in PHP specifically. It's a
>> dog of a language and barely holds together for ugly imperative
>> programming, let alone other paradigms...
>>>> Anyone knows libraries/references where I can look for?
>> it looks like the bastard son after some orgy full of perls, javas,
>> pythons and C... functional programming into that mix won't matter at
>> all...
> I don't like php, but my boss wants it. So I was guessing whether someone > here had a remedy to alleviate the pain.
I agree to the bastard son, but this should not keep you from writing good code.
All (small question mark here) of the necessary features are there.