Re: [PHP-DEV] Implementation help needed: Currying RFC

2011-06-07 Thread Johannes Schlüter
On Mon, 2011-06-06 at 01:28 +0200, Lars Strojny wrote: I¹ve finally found some time to put together a first draft of an RFC for currying (https://wiki.php.net/rfc/currying). This is basically meant as a starting point to find a clean and concise syntax for PHP. So, if you kinda like what

Re: [PHP-DEV] Implementation help needed: Currying RFC

2011-06-07 Thread Lars Strojny
Hi Johannes, Thank you very much for your detailed feedback. Am 07.06.11 12:40 schrieb Johannes Schlüter unter johan...@schlueters.de: [...] I wonder how your proposal would work with a variable number of arguments. Taking a piece out of your RFC: $apos = curry strpos(..., 'a')); Would the

RE: [PHP-DEV] Implementation help needed: Currying RFC

2011-06-07 Thread John Crenshaw
$apos = curry strpos(..., 'a')); $apos(); // runtime error wrong param count? $apos(bar); // fine $apos(bar, foo); // 'a' casted to long, used as offset? $apos(bar, foo, 0); // run-time error wrong param count? I understand where this can be useful sometimes, but I disagree

Re: [PHP-DEV] Implementation help needed: Currying RFC

2011-06-07 Thread Lars Strojny
Hi John, thanks for your feedback. Am 07.06.11 15:43 schrieb John Crenshaw unter johncrens...@priacta.com: [...] I understand where this can be useful sometimes, but I disagree that this should be added as a language feature. It is still possible to implement this (parameter positioning in your

Re: [PHP-DEV] Implementation help needed: Currying RFC

2011-06-07 Thread Martin Scotta
Martin Scotta On Tue, Jun 7, 2011 at 10:43 AM, John Crenshaw johncrens...@priacta.comwrote: $apos = curry strpos(..., 'a')); $apos(); // runtime error wrong param count? $apos(bar); // fine $apos(bar, foo); // 'a' casted to long, used as offset? $apos(bar, foo, 0);

RE: [PHP-DEV] Implementation help needed: Currying RFC

2011-06-07 Thread John Crenshaw
-Original Message- From: Lars Strojny [mailto:l...@strojny.net] I understand where this can be useful sometimes, but I disagree that this should be added as a language feature. It is still possible to implement this (parameter positioning in your curried function) using a function

Re: [PHP-DEV] Implementation help needed: Currying RFC

2011-06-07 Thread Lars Strojny
Hi Martin, Am 07.06.11 17:09 schrieb Martin Scotta unter martinsco...@gmail.com: [...] Hey Jhon, What about writing your curry idea in plain PHP, as a proof of concept. Then you can show examples live and others can toy with it. Yep, working on it. With regards, Lars -- PHP Internals - PHP

RE: [PHP-DEV] Implementation help needed: Currying RFC

2011-06-07 Thread John Crenshaw
Hey John, What about writing your curry idea in plain PHP, as a proof of concept. Then you can show examples live and others can toy with it. I'm pretty sure most php developers are not used to curry -- or at least those who don't have functional programming skills I'll consider this.

Re: [PHP-DEV] Implementation help needed: Currying RFC

2011-06-07 Thread Lars Strojny
So, here we go, simple prototype of what John suggested: - Test Case: https://github.com/lstrojny/functional-php/blob/playground/tests/Functional /CurryTest.php - Implementation: https://github.com/lstrojny/functional-php/blob/playground/src/Functional/C urry.php With regards, Lars Am

[PHP-DEV] Implementation help needed: Currying RFC

2011-06-05 Thread Lars Strojny
Hi everybody, if you know how to do some weird things to PHP¹s parser and like functional¹ish elements in PHP, please read further. I¹ve finally found some time to put together a first draft of an RFC for currying (https://wiki.php.net/rfc/currying). This is basically meant as a starting point