News for hackers. Stuff that matters.
Re:Pipe Operator (|>) For JavaScript by WastingMyTime89 on Friday January 20, 2023 @11:24AM (#34455344)
Pipes work really well with named arguments and partial-application. Both functionnalities make it to get the unary function you want with minimal cruft and lambdas solve the more complex case.

In Ocaml, you often end up doing things like:

     List.create 0 3 
     |> List.map ~f:(fun x -> x+1)
     |> List.fold ~init:0 ~f:(fun acc x -> x+acc)
     |> Stdio.print_endline "%d"
I'm ambivalent about adding them to JS however. It's a nice feature but I don't think it works well with the rest of the syntax.

There are no comments on this comment yet.