Hacker Newsnew | past | comments | ask | show | jobs | submitlogin

Yes, a small feature set is important, and adding the functional-style pipe to languages that already have chaining with the dot seems to clutter up the design space. However, dot-chaining has the severe limitation that you can only pass to the first or "this" argument.

Is there any language with a single feature that gives the best of both worlds?



FWIW you can pass to other arguments than first in this syntax

```

params

|> Map.get("user")

|> create_user()

|> (&notify_admin("signup", &1)).() ```

or

```

params

|> Map.get("user")

|> create_user()

|> (fn user -> notify_admin("signup", user) end).() ```


BTW, there's a convenience macro of Kernel.then/2 [0] which IMO looks a little cleaner:

    params
    |> Map.get("user")
    |> create_user()
    |> then(&notify_admin("signup", &1))

    params
    |> Map.get("user")
    |> create_user()
    |> then(fn user -> notify_admin("signup", user) end)

[0] https://hexdocs.pm/elixir/1.18.3/Kernel.html#then/2


Do concatenative langs like Factor fit the bill?




Guidelines | FAQ | Lists | API | Security | Legal | Apply to YC | Contact

Search: