Ask HN: What's the best way to teach FP to EE/CS students?
I'm looking for an FP language where I can do something familiar (RPi programming, games, web stuff ... but not parsers and type-checkers). I'm looking for the FP equivalent of python in its simplicity of usage and immediate usability.
I have been trying Elixir, but it is more like Elixir is trying me :) I tried the Phoenix hello world application, and it was ready 10 minutes later after downloading 3.1G. I know that it is downloading a lot of batteries, but the sheer amount of things you need to know before you can deploy a silly app is mind-boggling. I tried nerves for the RPi, but it seems like every time you tweak one file, you have to burn the SD card all over again. Again, these are quite likely newbie problems, but when I have to deal with 50 newbies, they scale up! I haven't tried Clojure on the RPi.
Any suggestions? Alternatively, does anyone do FP in python? I am aware of the 'functional' package, and I could always teach functional principles in python (a side-effect free state machine, for example). But having first-class support in the language is so much easier. I have only used FP in the context of building type-checkers, so I don't have first-hand experience.
Sorry for the wall of text, but any ideas will be much appreciated.
4 comments
[ 5.4 ms ] story [ 16.7 ms ] threadKnowing that instead reverse the problem. Instead of teaching putting things together try instruction from tearing things apart. The goal being circumventing composition and replacing that with thinking about the solution, the end state. Composition, the thing beginners so fixate on, will come out about incidentally.
As for FP specifically there are two approaches people seem to think about: return value and structure. In teaching from return value the focus is upon input/output and control flow whether from chaining or nesting function calls as this tends to be more declarative. Teaching from the perspective of structure focuses more on scope, call order, and asynchronous states which tends to be more imperative. Let a given problem dictate the specifics of the FP execution.
As for specific languages Clojure is really popular in this area with an emphasis on conciseness. Haskell is syntax heavy but is the elder statesmen of FP languages. I prefer TypeScript myself, but is probably far less ideal for teaching these concepts.
Elm is certainly an excellent suggestion, and I will keep that in mind. Right now I have a bunch of super sharp EE people who are pretty decent python/C/embedded programmers, and I was looking for some language for which the barrier to entry is low.
Elixir's environment (mix) doesn't feel simple. Maybe it is just a matter of a little time. The documentation constantly makes references to erlang and to Ruby, so a student feels a bit on edge about the scope of learning.