nitpicking, but this is not a lambda. it's an anonymous function.
R adds native pipe and lambda syntax
121–130 of 150 posts
Re: R adds native pipe and lambda syntax
#122Earlier quoted context omitted.
There is none and after having used Elixir for a year going back to Python for anything non-trivial input/output parsing feels really cumbersome now. Other comments have mentioned that functional idioms make code harder to read for devs unfamiliar with the concepts but the pipe operator IMHO has no downsides (I am not even sure what it really has to do with funcational programming, other than that it happens to be us…
> Other comments have mentioned that functional idioms make code harder to read for devs unfamiliar with the concepts but the pipe operator IMHO has no downsides (I am not even sure what it really has to do with funcational programming, other than that it happens to be used in more functional languages). What it has to do with functional programming is, first, that it's right side operand is a function, and, second,…
Re: R adds native pipe and lambda syntax
#123Earlier quoted context omitted.
You need a columnar database for good performance. Try DuckDB to ease them into it, it's a columnar SQLite.
Thanks, I’m checking it out, it seems pretty interesting to keep an eye on. Lots of properties that would be useful in our shared computing environment like not requiring root or Docker.
Re: R adds native pipe and lambda syntax
#124Earlier quoted context omitted.
As someone who is now bouncing back & forth between Python and R on a weekly basis, I've been surprised (after making fun of R sometimes) how much I miss the piping when I leave R for Python. Pandas seems so inflexible by comparison, so nitpicky for little gain. I've been surprised again and again how much dplyr supports near-effortless fluency and productivity. Never really thought I'd be writing that in a public fo…
I'm not an R user, but you should try Julia for data analysis. It seems as flexibility (maybe more) than R, while also having blazing performance. I do like Pandas concept of row indices, which I know Julia (and I believe, R) lack.
Re: R adds native pipe and lambda syntax
#125Re: R adds native pipe and lambda syntax
#126Earlier quoted context omitted.
IMO it should be like Fennel and just support `lambda` and `λ`. The latter is not even that hard to type, in virtually any free (libre) OS you can just $ echo ' : "Λ" # GREEK CAPITAL LETTER LAMDA : "λ" # GREEK CAPITAL LETTER LAMDA ' >> ~/.XCompose If you’re limited by a nonfree OS you should be able to patch the problem with free duct tape like Karabiner or AutoHotKey. And in vim you can just *l in insert mode (which…
Now imagine doing that same thing for every system you're programming on. And then imagine having to do it for a million different symbols. I'm sure as hell glad you're not in charge of any of this.
Re: R adds native pipe and lambda syntax
#127Earlier quoted context omitted.
> The lambda syntax (\(x) -> x + 1) is similar to Haskell's (\x -> x + 1). The proposed lambda syntax for R is `\(x) x+1` so `\` will just be shorthand for `function`.
The anonymous function change is probably a (small) mistake. function(x) {x + 1} is already logically equivalent to and from some perspectives an arguable syntax improvement on \(x) x + 1 Giving everyone two ways of doing one thing just means the tutorials will be fragmented and beginners even more confused. Tierney mentioned that tidyverse found function(x) too verbose and uses fomula syntax. Given how tidyverse oft…
Re: R adds native pipe and lambda syntax
#128That backslash syntax is pretty funky, but then again all of R is a little funky. Very nice addition to the language though!
I must say I don't really see the point, given that function() does the same thing, with only a few more characters.
Re: R adds native pipe and lambda syntax
#129Earlier quoted context omitted.
This, along with inferior metaprogramming affordances, is the biggest reason pandas will never be as productive an analyst tool as R's dplyr. In R you can pipe anything into anything. In pandas you're stuck with the methods pandas gives you. This is also why pandas API is so bloated. A lot of pandas special-case functionality, like dropping duplicate rows, can be replicated in R by chaining together more flexible and…
Pandas does have the .pipe() method [0], which allows you to put an arbitrary callable in a method chain, but it is a bit more cumbersome than in R. [0] https://pandas.pydata.org/pandas-docs/stable/reference/api/p...
Re: R adds native pipe and lambda syntax
#130Earlier quoted context omitted.
Now imagine doing that same thing for every system you're programming on. And then imagine having to do it for a million different symbols. I'm sure as hell glad you're not in charge of any of this.
A better solution is just to use the word 'lambda', and let your text editor render it as a lambda symbol if you want (my emacs does this).
Everyone that doesn't have a fancy IDE now has 6-8 extra useless characters for something that should be syntax.