4 ms·
This is an uncharacteristically deep discussion of R. I also agree strongly with the "making R a 'real programming language' almost killed it" supposition. I fe
by peatmoss 8y ago
This is an uncharacteristically deep discussion of R. I also agree strongly with the "making R a 'real programming language' almost killed it" supposition. I feel like a lot of the genuine warts on R come from trying to take it from something that could be (and originally was?) a set of macros on top of Scheme, and turn it into the OOP language du jour.
R was my introduction to functional programming. About the time I was learning R for statistics in a masters program, I also discovered the book "How to Design Programs." The combination of HtDP plus the fact that you could (and perhaps should) mostly ignore the OOP parts of R made this a winning combination.
Today, I would like to see a slightly better general purpose language with first class statistics and graphics DSLs, however. To me, the obvious choice for all that is something like Racket, which already builds a sound base for pedagogy.
I'd also say that the starting point for such an endeavor should more or less start with the idea that it's cloning the Tidyverse. For me, the killer feature of the Tidyverse is that so many components started with a reasonable review of prior art in other languages.
Ggplot started with an academic understanding of the Grammar of Graphics, but also mapped that conceptual framework onto the significantly well-researched foundation that was R's Grid graphics. When I see people try and clone the syntax of Ggplot, I often find myself cringing that they've missed the extensibility of the underlying Grid Graphics system.
Given Racket's focus on building DSLs and purpose-specific languages, I think excelling at creating a user-friendly set of stats and data DSLs could be the killer demonstration for the Racket community. I just wish I had more time and expertise in Racket to make that dream a reality.
- peatmoss 8y agoI could go on about the tidyverse and how relatively well thought out / researched the grammars are. For a "not a real programming language" the R community is doing some of the most useful and interesting DSL creation out there. Dplyr is interesting, because not only does it present a conceptually consistent model for data manipulation, it also attempts to abstract details of the underlying (perhaps RDBMs) data storage. https://dplyr.tidyverse.org/ https://dplyr.tidyverse.org/ Dplyr thus begins to solve for two problems: The first is a functional way of describing complex data manipulation pipelines. The second is providing an easy way of dealing with mid-sized data (i.e. data that cannot fit in memory). Even the Tidyverse HTTP request library, httr, did its homework. Since R was comparatively late to http requests party, that homework was largely a review of http convenience libraries in Python, Javascript, C (Curl), etc.
- klodolph 8y ago> I feel like a lot of the genuine warts on R come from trying to take it from something that could be (and originally was?) a set of macros on top of Scheme, and turn it into the OOP language du jour. Well, R is based on S, which dates back to 1976. But R has lexical scoping, which is one of the big things it took from Scheme. If you're going to steal language features from Scheme, lexical scoping is at the top of the list.
- peatmoss 8y agoThat's a good point. My usage of R is quite a lot more recent than S, or even the original advent of R. I know that R originally built on an open source Scheme runtime, but in so doing, I don't know how much influence that had on the evolution of R as a language separate from S.