Answers.Body: <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>
  
Answers.ContentLicense: CC BY-SA 3.0
Answers.CreationDate: 2017-09-13T16:48:41.773Z
Answers.LastActivityDate: 2017-09-13T16:48:41.773Z
Answers.UserDisplayName: Ben I.
Answers.Body: <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>
  
Answers.ContentLicense: CC BY-SA 3.0
Answers.CreationDate: 2017-09-13T14:08:29.900Z
Answers.Text: 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.
Answers.UserDisplayName: Jay
Answers.ContentLicense: CC BY-SA 3.0
Answers.CreationDate: 2017-09-13T14:11:55.760Z
Answers.Text: Then you have other goals, of course, than teaching functional programming.
Answers.UserDisplayName: Buffy
Answers.ContentLicense: CC BY-SA 3.0
Answers.CreationDate: 2017-09-13T14:17:49.787Z
Answers.Text: 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.
Answers.UserDisplayName: Jay
Answers.ContentLicense: CC BY-SA 3.0
Answers.CreationDate: 2017-09-13T14:19:53.467Z
Answers.Text: 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.
Answers.UserDisplayName: Jay
Answers.ContentLicense: CC BY-SA 3.0
Answers.CreationDate: 2017-09-13T14:20:28.890Z
Answers.Text: 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.
Answers.UserDisplayName: Buffy
Answers.ContentLicense: CC BY-SA 3.0
Answers.CreationDate: 2017-09-13T14:23:00.210Z
Answers.Text: 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.
Answers.UserDisplayName: Jay
Answers.ContentLicense: CC BY-SA 3.0
Answers.CreationDate: 2017-09-13T15:41:26.147Z
Answers.Text: 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.
Answers.UserDisplayName: ctrl-alt-delor
Answers.ContentLicense: CC BY-SA 3.0
Answers.CreationDate: 2017-09-20T09:50:32.473Z
Answers.Text: 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.
Answers.UserDisplayName: VisualMelon
Answers.ContentLicense: CC BY-SA 3.0
Answers.CreationDate: 2017-09-13T13:54:52.793Z
Answers.LastActivityDate: 2017-09-13T14:11:11.970Z
Answers.LastEditDate: 2017-09-13T14:11:11.970Z
Answers.UserDisplayName: Buffy
Body: <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>
  
Comments.ContentLicense: CC BY-SA 3.0
Comments.CreationDate: 2017-09-15T00:26:45.903Z
Comments.Text: I think that Scala looks interesting and it builds on the JVM.
Comments.UserDisplayName: ncmathsadist
Tags: <functional-programming>
Title: Functional Programming - using F sharp
ThreadText: # 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.
  
  
  ---
  
  