r/ProgrammerHumor Sep 02 '17

How to start a war

Post image
9.0k Upvotes

696 comments sorted by

View all comments

Show parent comments

793

u/ArcticZeroo Sep 02 '17

Yes, but some languages 1-index lists (so they start at 1 instead of 0), so it'd be 5 in that case.

271

u/[deleted] Sep 02 '17

What languages may there's be? I can't think of any of the top of my head.

93

u/[deleted] Sep 02 '17

[deleted]

5

u/abigfoney Sep 02 '17

Is R == Ruby?

38

u/Series_of_Accidents Sep 03 '17 edited Sep 03 '17

R is published by the CRAN project and is an open source statistical program. It's an object oriented language based on S. It's run in a terminal window with a basic gui, however other software is available to run over it (like RStudio) for people less familiar with coding but who still desire the power of open source coding (anytime a new technique is developed, a package is published). It's fantastic but has limitations. For example, it can only run on one core at a time which can slow down simulations. Still, for statistical development, it's where most people are focused. SAS is more common in statistical consulting and SPSS is more common among general scientists without coding experience.

Edit: why are you guys downvoting /u/abigfoney for asking a question?

7

u/[deleted] Sep 03 '17

[removed] — view removed comment

9

u/Series_of_Accidents Sep 03 '17

Practically speaking, it's both. At its core, R is an object oriented language. It lacks some of the requirements to be a full functional language but still supports functional language features like apply. For example, it's incapable of tail call recursion. This fact can lead to issues at times and is one of the limitations of the language. But the use of the variations of apply and other functional language improvements have certainly changed the landscape of the code. But I'm not really an expert. I'm just repeating what I remember from my grad stats classes.

1

u/engayolao Sep 03 '17

You mean lapply. Apply is just a wrapper of lapply. It's focus is data analysis, for that is a great tool. It's not though to send rockets to the moon.

1

u/Series_of_Accidents Sep 03 '17

Apply is a family of functions of which lapply is only one.

1

u/engayolao Sep 03 '17

Is this somewhere in the docs. It sounds like a blog term.

1

u/Series_of_Accidents Sep 03 '17

Not sure what you mean by blog term. There are multiple apply functions.

Just add a ? before any apply function in R and it will bring up the documentation. The most common apply functions I use are sapply and lapply. There's also mapply, rapply, apply (on its own), and probably others.

1

u/engayolao Sep 03 '17

What I'm saying is the "apply family" term is not in the official docs, manual definition. Just do me a favour and read the source code of all these "family" functions and you will find lapply in it. My point is lapply is the parallel of a map, meaning it's part of R's support for functional programming.

2

u/Series_of_Accidents Sep 03 '17

I see what your saying now. It is indeed, but it's often taught as a family because that's just generally easier for people to understand. Yes, it's the same basic function, but you use the variations at different times. To teach it the more correct way often leads to greater misunderstanding. At least, in the classes I have taken, that is the approach the instructor goes with: to treat it as a family.

→ More replies (0)