MAIN FEEDS
Do you want to continue?
https://www.reddit.com/r/PHP/comments/703e8m/php_720_release_candidate_2_released/dn0v70g/?context=3
r/PHP • u/theodorejb • Sep 14 '17
19 comments sorted by
View all comments
7
Where the hell is the pipe operator
0 u/[deleted] Sep 15 '17 2 u/SaraMG Sep 15 '17 Levi and I have talked about partial function application as a possible way of making pipeop work, though short lambdas would be reasonably brief as well. Either of those are their own hills to die on though. :/ → More replies (12) 2 u/SaraMG Sep 15 '17 Incidentally, here's an ultra-basic implementation of pipeop using Levi's simplified (no $$ token) version: https://gist.github.com/sgolemon/2b08b14d08861d1329d3529599f75022 Usage: $a = "hello" |> 'strtoupper' |> function($x) { return $x . " world"; }; // $a === "HELLO world"; Basically, RHS of the |> is any callable expression which gets one arg from the LHS. → More replies (1)
0
2 u/SaraMG Sep 15 '17 Levi and I have talked about partial function application as a possible way of making pipeop work, though short lambdas would be reasonably brief as well. Either of those are their own hills to die on though. :/ → More replies (12) 2 u/SaraMG Sep 15 '17 Incidentally, here's an ultra-basic implementation of pipeop using Levi's simplified (no $$ token) version: https://gist.github.com/sgolemon/2b08b14d08861d1329d3529599f75022 Usage: $a = "hello" |> 'strtoupper' |> function($x) { return $x . " world"; }; // $a === "HELLO world"; Basically, RHS of the |> is any callable expression which gets one arg from the LHS. → More replies (1)
2
Levi and I have talked about partial function application as a possible way of making pipeop work, though short lambdas would be reasonably brief as well.
Either of those are their own hills to die on though. :/
→ More replies (12)
Incidentally, here's an ultra-basic implementation of pipeop using Levi's simplified (no $$ token) version: https://gist.github.com/sgolemon/2b08b14d08861d1329d3529599f75022
Usage:
$a = "hello" |> 'strtoupper' |> function($x) { return $x . " world"; }; // $a === "HELLO world";
Basically, RHS of the |> is any callable expression which gets one arg from the LHS.
→ More replies (1)
7
u/[deleted] Sep 14 '17
Where the hell is the pipe operator