alpaca icon indicating copy to clipboard operation
alpaca copied to clipboard

Auto-imported pipe operator

Open lpil opened this issue 7 years ago • 2 comments

Hello!

I'd like to suggest adding an automatically imported pipe-forward function to Alpaca.

let value |> func =
  func value 

This would allow us to chain functions to avoid some unneeded variables while still writing in an easy-to-read left-to-right/top-to-bottom style. :)

"123"
|> string.chars
|> list.reverse
|> string.join "-"
-- "3-2-1"

lpil avatar Jan 06 '18 19:01 lpil

IIRC @lepoetemaudit has implemented this somewhere as a proof of concept. Might fit in with @Licenser's ideas in #184, whatever form that takes?

j14159 avatar Jan 06 '18 23:01 j14159

<3 I'm still in love with the idea if implementing part of alpaca in alpaca it feels so elegant and easy to reason about :D

Licenser avatar Jan 06 '18 23:01 Licenser