On Fri, Feb 7, 2025, at 10:51 AM, Christoph M. Becker wrote:
>> Of particular note, since the last RFC I have concluded that a compose operator is a
>> necessary complement to a pipe operator. However, it's also going to be notably more work, and
>> the two operators don't actually interact at all at the code level, so since people keep saying
>> "Small RFCs!", here's a small RFC. :-)
>
> Fair enough. And with the pipe operator, one might live without a
> compose operator, e.g.
>
> $f1 = fn($x) => 2 * $x;
> $f2 = fn($x) => $x + 3;
> // $f3 = $f2 ∘ $f1
> $f3 = fn($x) => $x |> $f1 |> $f2;
>
> Christoph
The v2 RFC took that position, that compose was easy enough to emulate via pipe. Indeed, pipe and
compose can both be implemented in terms of each other. However, since the previous RFC I've
concluded[1] that both are sufficiently useful that we really out to include both of them. PIpes
are just way easier to implement in practice. :-)
--Larry Garfield
[1] https://peakd.com/hive-168588/@crell/aoc2021-review