I guess I must be some kind of utterly brilliant high level thinker.
Basically the idea of functional languages is to tell the computer what to do - not how to do it.
For years I have dealt with ALL programming languages functionally, as "functional languages".
I believe that any
decent developer is professionally obliged to learn how to do this.
The mediocre seat warming ones are those who think "in" the one language they know and never deviate. I don't even have to give concrete examples of this on this board.
For example...
I do not not really consider this:
for (city <- citiesWithT) println(city)To be altogether THAT different from this:
Iterator<String> iter2 = citiesWithT.iterator();
while (iter2.hasNext()) {
String city = iter2.next();
System.out.println(city);In any environment, I tend to formulate my programming like this:
"Gee, I want to operate on every element in (this list) in (this way). Order (does, or does not) matter (and if it does, here is the ordering.) I want to start (from the beginning, or from a particular element) and end (at, or one element before) the element (at the end, or, the element that fulfills this condition, or, a particular element.)"
That's how I have reasoned for about the last 15 years of programming life, really. I find it really hard to NOT think functionally like this. I have a task. What does the damned tool provide to accomplish this task? Ok, so do it. Then move on.
Does that make me: ordinary; highly experienced; guru like; jaded; naive?
In my opinion, knuckleheads, fanbois, and newbies flounder around pontificating on the most efficient or most stylish way to implement what is just a vanilla list iteration operation.
The major difference we see in your examples appears to be that one language has more features such as knowledge of higher level constructs like lists built into it, as well as operations on those constructs like list iteration built in, than does the "procedural" language. And in the more "advanced" language there exists shorthand for routine operations like looping across an iterator collection.
I do consider something like SQL to be entirely unique because you do not think in terms of the order of execution at all there, in fact, that can often screw you up.
I grant everything you guys are saying. But, I consider it a sign of professional maturity in this industry when the developer stops thinking about every single new language with novel semantics as the Second Coming and the Epiphany.
Aside - I am not saying that you are doing this, Peter. I consider your interest research-oriented. Just that the type of programmer that, say, the body shops are looking for, for commodity temp programming positions, DOES tend to reason this way.
If you write enough code you eventually start noticing more similarities between different tools than differences.
{ } or BEGIN END? Trifles. Use a macro replacement for things like that, you're done.