# What would be the classification of R according to paradigms?

I would like to know in which classification is the R programming language. It has elements of the imperative paradigm and object oriented paradigm (some things like that even a number is an object and they can be freely mixed). I am not quite sure if it has functional programming characteristics. So it can be considered a scripting language?

What would be its classification in one of the paradigms?

R can do tasks in batches so it can be considered also a scripting language, is that so?

• Multi-paradigm! – Dave Clarke Jan 15 '13 at 16:22
• Programming paradigms aren't independant (for instance object oriented is usually considered as an extension of imperative). See for instance: Programming Paradigms for Dummies p. 5 where there is a figure presenting a taxonomy of programming paradigms. And scripting isn't usually considered as a programming paradigms; it is for sure absent of that taxonomy. – AProgrammer Jan 15 '13 at 16:32
• Wikipedia has a list. I'm not convinced this is a cs question though. Maybe it would have been more fitting in programmers? – Karolis Juodelė Jan 15 '13 at 17:31
• @KarolisJuodelė The theory of programming languages is a computer science subject. It's on-topic here. – Gilles Jan 15 '13 at 22:00
• From what I've seen of R, I don't think it uses the term "object" in the same sense as other languages. – Raphael Oct 9 '16 at 15:25

## Scripting language

I once heard the following definition of what a scripting language as at some conference. Namely, if its main purpose is to orchestrate components that exist in their own rights outside of the language. Consider a theatre script - it orchestrates actors who all exist independently of the script. Bash scripts and batch files (the latter article even has a section entitled "Other Windows scripting languages") are prototypical representatives of a scripting language according to the given definition, because they are completely useless if you couldn't invoke external tools or commands like grep, ls or cd.

The most important part of this definition is the "to orchestrate components that exist in their own rights outside of the language" bit. At the end of the day, all computer languages (no coined term AFAIK) allow you to orchestrate components, thereby creating more new and complex components. However, in a programming language you mainly orchestrate library functions that only exist because the programming language exist.

As a last remark: imperative programming includes both aforementioned paradigms and is different from declarative programming. An imperative language focuses on the "how to do things" and consists of more or less directly executable steps, whereas a declarative language focuses on the "what to achieve". As an example, consider sorting a list. An imperative program what consists of a procedure/method that moves elements around and thereby sorts the list, and each single instruction can be executed in a sort of obvious way. A declarative program would consist of a description of the property "sorted", but how to "execute" the property is not at all obvious. If you are interested in the differences, have a look at Quicksort implemented in Java and Prolog (among others).

## What Wikipedia says

Addressing a comment by @vonbrand and in support of my reply to that comment, here are a couple of quotes from Wikipedia:

The first line in the article on Perl describes Perl as a

Perl is a high-level, general-purpose, interpreted, dynamic programming language.

but in the second paragraph you find

Perl was originally developed by Larry Wall in 1987 as a general-purpose Unix scripting language to make report processing easier.

It is similar for Python, where the first paragraph is

Python is a general-purpose, interpreted high-level programming language whose design philosophy emphasizes code readability. Its syntax is said to be clear and expressive. Python has a large and comprehensive standard library.

In the second paragraph you'll find

Like other dynamic languages, Python is often used as a scripting language, but is also used in a wide range of non-scripting contexts.

which, I think, supports my comment given below quite nicely.

Furthermore, the article about scripting languages defines

A scripting language or script language is a programming language that supports the writing of scripts, programs written for a software environment that automate the execution of tasks which could alternatively be executed one-by-one by a human operator.

and then goes on as follows, where the first sentence is, in my opinion, the most important one

Scripting is usually a property of the primary implementations of a language, rather than a language per se, although many languages are not very suited to this kind of implementation. For example, C++ interpreters do exist, but C++ is generally not considered a scripting language for two reasons: these implementations are rarely used, and the time required to write program in C++ would be far greater than the time required to write an equivalent script in a language like Python.

• But languages such as Perl or Python are considered "scripting", even though they are rarely used to orchestrate other programs' activities. – vonbrand Jan 27 '13 at 3:39
• You are right in that dynamically typed languages such Perl and Python are often referred to as "scripting languages". However, a "scripting language" is not a programming paradigm, as @AProgrammer already pointed out. I conjecture, that the term became popular together with the rise of Perl or Tcl that were often used by administrators as a more powerful replacement of shell scripts. That is, they were used for tasks for which people would previously have used a "real" scripting language, hence the name. – Malte Schwerhoff Jan 28 '13 at 9:26
• @vonbrand See the Wikipedia quotes I added – Malte Schwerhoff Jan 28 '13 at 9:49
• Perl is a better Bourne shell, and the Bourne shell is a command line interpreter: a Bourne shell script is an orchestration of commands you would have to type interactively otherwise. So a script orchestrate one's use of the command line to interact with the OS. Perl is rarely used in REPL (interactive) mode, but because for many Perl scripts, equivalent Bounre shell scripts could be written, those Perl scripts can still be said to automate what would otherwise be interactive use of the system. – reinierpost Aug 26 '15 at 8:13
• So the term "scripting language" has more than one meaning. Originally, I think, it was used to mean interaction automation language, later it was extended to mean language suitable for being used as an interaction automation or extension language. (Perl and Python often are.) Not all interpreted or dynamic languages are called scripting languages - e.g. Lisp or BASIC usually aren't (although they, too, are used as extension languages). – reinierpost Aug 26 '15 at 8:19