<p>I agree with Buffy that, if the goal is to actually understand functional programming, using a true functional language makes more sense. Get rid of the temptation to move back into imperative programming, or the odds your students have of really understanding this new mindset diminish considerably.</p>

<p>You may want to take a look at the discussions over <a href="https://cseducators.stackexchange.com/questions/106/scheme-vs-haskell-for-introducing-functional-programming">here</a>.  When I asked that question, I was unsure whether to use Haskell or Scheme, and the answers there (especially <a href="https://cseducators.stackexchange.com/a/391/27">this one</a>) ultimately led me to choose Scheme (DrRacket in particular).  The idea of pedagogical sub-languages for distilling the key ideas was very persuasive.  I think that this is a great way to get into functional programming.</p>

CC BY-SA 3.0
2017-09-13T16:48:41.773Z
2017-09-13T16:48:41.773Z
Ben I.
<p>Actually, I think a better choice would be a true functional language (Scheme, ML, Haskell) rather than a multi-paradigm language. </p>

<p>Of course it depends on your goals. If you <em>really</em> want them to learn the functional programming mindset then don't use a language that lets them escape to other paradigms so easily. F# permits programming in many ways, including imperative and OOP. So, if they have a multi-paradigm language, you can either just let them program using what is available or you can try to enforce a style that may not be natural in the language. I think this would be frustrating - more frustrating than just pushing through the needed transition of thought. </p>

<p>However, in a true functional language you don't have the option of just "making it work" using thought patterns you have already developed when learning a different paradigm. The transition to functional can be difficult, but it isn't made easier by letting students not do it. </p>

<p>If you want them to run, don't let them crawl. </p>

<p>I'll note that I with a bit of a library I can program functionally in Java. But I wouldn't use that as a way to teach functional programming. </p>

CC BY-SA 3.0
2017-09-13T14:08:29.900Z
We simply do not have the luxury of pursuing something which does not have an endgame that has no industrial applications. For us, any time spent learning something is an investment and must have (monetary) returns. Would understanding Scheme, eventually lead us to using F sharp better? We understand that it will be challenging but we have already taken that into consideration.
Jay
CC BY-SA 3.0
2017-09-13T14:11:55.760Z
Then you have other goals, of course, than teaching functional programming.
Buffy
CC BY-SA 3.0
2017-09-13T14:17:49.787Z
That is true. Step 1 : Learn functional Programming with Language X Step 2 : Do something with it. Step 3 : Profits :P However, we are still in step 1, and we have to finalise on a functional programming first. If we need to start with Scheme, then we will do that, but I thought I will ask the experts here first since you folks talk about functional programming so much as it is. My own mentor is convinced that F sharp is awesome for functional programming but he has no option on other languages.
Jay
CC BY-SA 3.0
2017-09-13T14:19:53.467Z
At the same time, while I got lucky with these 2 students, we are unable to convince other students to join us because they are asking us 'what is the end game if we learn'. So, if we can prove that functional programming has practical applications, we can get more students to participate next year, if not this year.
Jay
CC BY-SA 3.0
2017-09-13T14:20:28.890Z
I assume your students have most experience with languages that use concrete syntax. A shorter step for them would be ML (OCAML) or Haskell, rather than Scheme. It would seem more familiar, but would _require_ the change in mental processing.
Buffy
CC BY-SA 3.0
2017-09-13T14:23:00.210Z
We have already agreed that we will have to fundamentally alter the way we do things with functional programming. We are ready for that. So, ML or Haskell. Hmm....alright, I will add that to my notes then.
Jay
CC BY-SA 3.0
2017-09-13T15:41:26.147Z
When I learn Scheme, I never used it again (so apparently no pay off). However the way that I now write C, C++, C#, python, has changed for the better. I now do these 90% in a functional way. As a result there are less bugs, and it can be made multi-threaded more easily.
ctrl-alt-delor
CC BY-SA 3.0
2017-09-20T09:50:32.473Z
Just to add to user2923's comment: if you teach them OCAML, they can use it for F# in the 'real world' (it is pretty much ML compatible). I was taught OCAML at University (already knowing some F#), and even ended up using F# documentation for some of the ported libraries because I had an easier time reading them. This way, you hide away the 'imperative' features without using an 'obscure' language.
VisualMelon
CC BY-SA 3.0
2017-09-13T13:54:52.793Z
2017-09-13T14:11:11.970Z
2017-09-13T14:11:11.970Z
Buffy
<p>I learnt a lot (like kept hearing about it) about functional programming after coming to this community. I had heard of it before but was unaware of its importance. Then, I started including functional programming in my daily conversations with my students.</p>

<p>Now, a couple of students (who are already familiar with dot net) are asking me if I can teach them functional programming. Given that I am a dot net guy, my mentor suggested that I try F sharp. </p>

<p>The question is, is F sharp a good choice for learning functional programming? If not F sharp what are the alternatives.</p>

<p>Note : Any alternatives that you suggest must have full support on windows as well as Mac. For example, F sharp works just fine on Visual Studio for Windows and Visual Studio for Mac. </p>

CC BY-SA 3.0
2017-09-15T00:26:45.903Z
I think that Scala looks interesting and it builds on the JVM.
ncmathsadist
<functional-programming>
Functional Programming - using F sharp
# Functional Programming - using F sharp

(Asked by: username_0 on 2017-09-13)

I learnt a lot (like kept hearing about it) about functional programming after coming to this community. I had heard of it before but was unaware of its importance. Then, I started including functional programming in my daily conversations with my students.

Now, a couple of students (who are already familiar with dot net) are asking me if I can teach them functional programming. Given that I am a dot net guy, my mentor suggested that I try F sharp.

The question is, is F sharp a good choice for learning functional programming? If not F sharp what are the alternatives.

Note : Any alternatives that you suggest must have full support on windows as well as Mac. For example, F sharp works just fine on Visual Studio for Windows and Visual Studio for Mac.

**Tags:** functional-programming

> **Comments:**
> **username_1**: I think that Scala looks interesting and it builds on the JVM.  

---

## 2 answers

### Answer by username_3 on 2017-09-13. Score: 4 | Accepted answer

Actually, I think a better choice would be a true functional language (Scheme, ML, Haskell) rather than a multi-paradigm language.

Of course it depends on your goals. If you *really* want them to learn the functional programming mindset then don't use a language that lets them escape to other paradigms so easily. F# permits programming in many ways, including imperative and OOP. So, if they have a multi-paradigm language, you can either just let them program using what is available or you can try to enforce a style that may not be natural in the language. I think this would be frustrating - more frustrating than just pushing through the needed transition of thought.

However, in a true functional language you don't have the option of just "making it work" using thought patterns you have already developed when learning a different paradigm. The transition to functional can be difficult, but it isn't made easier by letting students not do it.

If you want them to run, don't let them crawl.

I'll note that I with a bit of a library I can program functionally in Java. But I wouldn't use that as a way to teach functional programming.

> **Comments:**
> **username_0**: We simply do not have the luxury of pursuing something which does not have an endgame that has no industrial applications. For us, any time spent learning something is an investment and must have (monetary) returns. Would understanding Scheme, eventually lead us to using F sharp better? We understand that it will be challenging but we have already taken that into consideration.  
> **username_3**: Then you have other goals, of course, than teaching functional programming.  
> **username_0**: That is true. Step 1 : Learn functional Programming with Language X Step 2 : Do something with it. Step 3 : Profits :P However, we are still in step 1, and we have to finalise on a functional programming first. If we need to start with Scheme, then we will do that, but I thought I will ask the experts here first since you folks talk about functional programming so much as it is. My own mentor is convinced that F sharp is awesome for functional programming but he has no option on other languages.  
> **username_0**: At the same time, while I got lucky with these 2 students, we are unable to convince other students to join us because they are asking us 'what is the end game if we learn'. So, if we can prove that functional programming has practical applications, we can get more students to participate next year, if not this year.  
> **username_3**: I assume your students have most experience with languages that use concrete syntax. A shorter step for them would be ML (OCAML) or Haskell, rather than Scheme. It would seem more familiar, but would _require_ the change in mental processing.  
> **username_0**: We have already agreed that we will have to fundamentally alter the way we do things with functional programming. We are ready for that. So, ML or Haskell. Hmm....alright, I will add that to my notes then.  
> **username_4**: When I learn Scheme, I never used it again (so apparently no pay off). However the way that I now write C, C++, C#, python, has changed for the better. I now do these 90% in a functional way. As a result there are less bugs, and it can be made multi-threaded more easily.  
> **username_5**: Just to add to user2923's comment: if you teach them OCAML, they can use it for F# in the 'real world' (it is pretty much ML compatible). I was taught OCAML at University (already knowing some F#), and even ended up using F# documentation for some of the ported libraries because I had an easier time reading them. This way, you hide away the 'imperative' features without using an 'obscure' language.  

---

### Answer by username_2 on 2017-09-13. Score: 2

I agree with username_3 that, if the goal is to actually understand functional programming, using a true functional language makes more sense. Get rid of the temptation to move back into imperative programming, or the odds your students have of really understanding this new mindset diminish considerably.

You may want to take a look at the discussions over [here](https://cseducators.stackexchange.com/questions/106/scheme-vs-haskell-for-introducing-functional-programming). When I asked that question, I was unsure whether to use Haskell or Scheme, and the answers there (especially [this one](https://cseducators.stackexchange.com/a/391/27)) ultimately led me to choose Scheme (DrRacket in particular). The idea of pedagogical sub-languages for distilling the key ideas was very persuasive. I think that this is a great way to get into functional programming.


---

