News for hackers. Stuff that matters.
Re:Higher Order PHP by CalmQuiet on Friday February 06, 2009 @12:09PM (#469975)
This is why I appreciate YHacker News: Don't know when I would have run across this otherwise.

Futher comment shall wait until after my first hand dabbling in a new approach: In my next non-mission-critical PHP web hobbyist app.

Re:Higher Order PHP by mk on Friday February 06, 2009 @12:29PM (#470003)
Exactly. Even though lately there has been a lot of new users and a lot of meta discussion, there are still interesting posts like this one. Personally I have moved away from PHP and to Django, but I am looking forward to PHP 5.3.
Re:Higher Order PHP by apgwoz on Friday February 06, 2009 @12:35PM (#470013)
Thanks for calling my post interesting. If it weren't for me having to deal with PHP at work, I wouldn't have even considered looking at PHP 5.3, but since I do, this represents a way for me to use PHP which is at least a little more consistent with the way I reason about programming in other languages such as Scheme (and in some ways Python, though map, and filter aren't 'Pythonic' anymore).
Re:Higher Order PHP by nuclear_eclipse on Friday February 06, 2009 @03:44PM (#470321)
> "though map, and filter aren't 'Pythonic' anymore"

How come? I must have missed the memo...

Re:Higher Order PHP by apgwoz on Friday February 06, 2009 @03:54PM (#470342)
list comprehensions take care of them. Guido wanted to remove them from Python 3.

   map = lambda f, a: [f(x) for x in a]
   filter = lambda f, a: [x for x in a if f(x)]
Re:Higher Order PHP by sciolizer on Saturday February 07, 2009 @06:44PM (#471593)
List comprehensions cover 90% of the use cases, but I'm glad map and filter were not removed. List comprehensions do not have first class status. You can pass map and filter around as arguments to other functions, but you cannot pass around "for", "in", and "if".
Re:Higher Order PHP by apgwoz on Saturday February 07, 2009 @07:16PM (#471619)
You're right, but even if they were removed, see above for their definition. :)
Re:Higher Order PHP by nuclear_eclipse on Friday February 06, 2009 @06:29PM (#470557)
Makes sense; thank you for the explanation.