@AlejandroP @milesmcbain

Such an approach is quite realistic. Actually, the whole concept of functional programming is based on this. Lookup scala, lisp, haskel or elixir if you'd like to know more about functional programming languages.

But yes, like R, most 'statement based' aka non-functional languages can be written in a similar fashion.

@Byebyehello @AlejandroP you’re putting R in the wrong camp my friend. It’s a lisp under the hood and if we can call Elixir a functional lang then R can be one also.

@milesmcbain @AlejandroP

A quick search whether R is a functional programming language raises indeed interesting discussions and articles.

Where both allow impure functions, R does seem to support mutable variables. I think that is where elixir differs here.

But yes, under the hood R is more functional than I initially thought. Thanks for the insight.

I must admit I have not used elixir that much, it is mostly the docs that state it is a FPL. Lisp, haskell and scala are better examples

@Byebyehello @AlejandroP no worries!

In R you can only truly mutate something if you hold the only reference to it, otherwise you mutate a copy and make a new binding. While not strictly FP style, I do feel it is in the spirit, since it prevents any shared mutable state.