| Oh god, all those functional examples w/ the Fibonacci function are malpractice. This was a big fight in the early 1980s because people who liked languages like Lisp and Logo were really pissed because Microsoft BASIC was everywhere. The old way iterative we did it in BASIC or FORTRAN was better. Back in the 1980s the best "functional" examples involved drawing fractals, something that could drive you crazy if you tried to do it in BASIC. If you are really smart you will use the closed form for Fibonacci which I think involves some really cool math https://fabiandablander.com/r/Fibonacci.html I have met so many young programmers who wander from job to job like itinerant martial artists looking for the true functional programming enlightenment and never finding it because... it doesn't exist. Functional and OO both started in the late 1970s and OO has prospered more because it is the key to writing simulations, graphical UIs, and many other kinds of programs. There are a lot of great ideas that came from the ML languages that are absolutely mainstream today, like algebraic types and pattern matching and you are seeing these being carefully weaved into languages like Java and Python right now. (Turns out those ideas from ML are really convenient for writing compilers!) As @retrocryptid works around, you get real enlightenment from learning how compilers work, which is a bit advanced for the beginning programmer but you might be able to show people the power of interpreters early on. At my high school (that I attended part time in the 4th grade) we ran BASIC on an old PDP-8 and would draw "graphics" on the line printer with a simple DSL that came to a list of statements to the effect of "draw + 35 times, draw a space 15 times" which exposed us to some of the discipline involved in more complex programs. (Those old adventure games like Zork and the Scott Adams games always involved a specialized interpreter because without OO functionality it would be terrible to try writing that in BASIC, FORTRAN or Assembly.) Start with "a monad is like a burrito" and you will lose even more people in CS 101 than they lose already. |