11 ms·
I say the best way to teach fp is to build real world apps and contrast them with apps build with non fp style. So ideally a language which supports both imper
by aszen 5y ago
I say the best way to teach fp is to build real world apps and contrast them with apps build with non fp style.
So ideally a language which supports both imperative and functional style, something like javascript is good to get people started.
After that a pure fp langauge can be introduced, which I would suggest to be Elm since it can be used to build games and apps for the web
- sriram_malhar 5y agoYes, that is precisely my starting point - real world apps. I want to avoid a mixed mode approach (for example, python with the 'functional' package) because I feel that immutability (for example) is best learnt in an environment that doesn't support mutability at all. It'd be nice to have pattern matching as well, because it is easier to parse network protocols (as in Erlang's binary matching)
- aszen 5y agoThing is since they are students with less coding experience they won't know the dangers of mutability and why immutability is a better choice. That is why a contrast between the two approaches is useful, you want to demonstrate what immutability enables. A pure functional approach is useful if you have suffered the perils of mutability and want to see the light
- sriram_malhar 5y agoYes, I have been showing a bunch of examples of _systems_ that have these properties, such as the data structures in the linux kernel protected by RCU locks, multi-version databases, git etc. 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.