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.