Live data from Hacker News

R adds native pipe and lambda syntax

developer.r-project.org

1–10 of 150 posts

Re: R adds native pipe and lambda syntax

#5
post #4

That backslash syntax is pretty funky, but then again all of R is a little funky. Very nice addition to the language though!

AFAIK the same as in Julia.

I think that symbol is used as an approximation of "lambda" character (λ) on a standard US keyboard.

Re: R adds native pipe and lambda syntax

#6
I'm sure some of us who are out of the loop might be wondering: what about the magrittr pipe operator (%>%) that we all know and love?

Luke Tierney explains the move from %>% to a native pipe |> here [1]. The native pipe aims to be more efficient as well as addresses issues with the magrittr pipe like complex stack traces.

Turns out the |> syntax is also used in Julia, Javascript and F#.

The lambda syntax (\(x) -> x + 1) is similar to Haskell's (\x -> x + 1).

[1] https://www.youtube.com/watch?v=X_eDHNVceCU&feature=youtu.be...

Post reply on HN