Answers.Body: <p>Using C# (or some other OOP or procedural language) as example for the inherently recursion-based Scheme is harmful. You need to (re)learn how to program to grok Scheme, different languages are just a distraction.</p>
  
  <p>Never forget the saying of "FORTRAN with semicolons" for much of the Pascal written in the beginning. Yes, contrasting different solutions in languages from varying paradigms is enlightening... <em>if you know the relevant languages/paradigms beforehand</em>.</p>
  
Answers.ContentLicense: CC BY-SA 4.0
Answers.CreationDate: 2018-05-18T17:43:25.087Z
Answers.Text: Teaching Scheme from first principles to developers that already know C# will require them to unlearn quite a bit regardless.  I'm not sure that showing them the C# version is that harmful--especially if one sticks to very isolated code fragments of C#
Answers.UserDisplayName: Onorio Catenacci
Answers.ContentLicense: CC BY-SA 4.0
Answers.CreationDate: 2018-05-18T14:45:05.113Z
Answers.LastActivityDate: 2018-05-18T14:45:05.113Z
Answers.UserDisplayName: vonbrand
Answers.Body: <p>A Rosetta Stone is a temping way of thinking about the issue, and it works if the person knows <em>two</em> languages already (the way that we knew two of the languages on the Rosetta Stone and were trying to learn the third one). This is similar to how if you have two points of reference on a map, you can triangulate to locate a third.</p>
  
  <p>But those first two languages are going to be holy hell to learn. That is because no Rosetta Stone exists if you haven't learned one language, let alone two. Fortunately, we learn to speak when we are babies, everything is irritating anyway, and we forget the whole thing! If only we started to program when we were 2. Maybe future generations will...</p>
  
  <p>I started off sitting in front of a terminal hooked to a PDP-11, using either a shell script language or Basic, I forget which. When I could, I used one of the Apple ][s with Basic, until I got one myself in high school. I learned a smattering of Assembly then also. My first college course was in APL. From the standpoint of Basic and Assembly, this is Hieroglyphics indeed. Next we learned Lisp. It was all Greek to me for a while, some students never mastered it and washed out. None of these languages had anything in common, any more than Cuneiform, Linear-B and Hieroglyphics do, beyond the idea that: <em>"we want the computer to do something."</em></p>
  
  <p>That is not much to go on. Really, the only analogy shared by all forms of computing is: "we want the computer to do something." And people are just so creative in coming up with ever-more varied ways of forming such utterances. (Perhaps we should try standardizing a bit instead?) (Shh! You'll ruin the story)</p>
  
  <p>All I can say is, keep throwing stuff at them, and if they can stay afloat, they might decide to make a living at it.</p>
  
Answers.ContentLicense: CC BY-SA 3.0
Answers.CreationDate: 2018-03-20T14:15:21.590Z
Answers.Text: Well in my case in particular I'm teaching professional developers who already know C#; I'm attempting to teach them Scheme.  So it's not quite as dire as trying to teach people who've never coded two languages at the same time. :)
Answers.UserDisplayName: Onorio Catenacci
Answers.ContentLicense: CC BY-SA 3.0
Answers.CreationDate: 2018-03-22T08:27:16.693Z
Answers.Text: @OnorioCatenacci, if they're already familiar with .Net, maybe you should teach them F# before Scheme?
Answers.UserDisplayName: Peter Taylor
Answers.ContentLicense: CC BY-SA 3.0
Answers.CreationDate: 2018-03-20T14:09:49.927Z
Answers.LastActivityDate: 2018-03-20T14:09:49.927Z
Answers.UserDisplayName: user4724
Answers.Body: <p>I swiped a <strong>Scheme</strong> example from <a href="https://classes.soe.ucsc.edu/cmps112/Spring03/languages/scheme/SchemeTutorialA.html" rel="nofollow noreferrer">a tutorial</a> and created my own translation to a <strong>C# Console</strong> program. I tried to preserve the structure, naming and comments. The difference in length is mostly due to the placement of curly braces on separate lines vs the parens on same lines.</p>
  
  <p>We could criticize the C# code by saying that it has to be sprinkled liberally with 'static' and 'decimal', but then would have to explain how much is <em>missing</em> from the Scheme example: The Lisp Interpreter (the entire concept of an interpreter...) and the built-in handling of numeric types therein.</p>
  
  <h1>Scheme</h1>
  
  <pre class="lang-lisp prettyprint-override"><code>(define checkbook (lambda ()
  
  ; This check book balancing program was written to illustrate
  ; i/o in Scheme. It uses the purely functional part of Scheme.
  
          ; These definitions are local to checkbook
          (letrec
  
              ; These strings are used as prompts
  
             ((IB "Enter initial balance: ")
              (AT "Enter transaction (- for withdrawal): ")
              (FB "Your final balance is: ")
  
              ; This function displays a prompt then returns
              ; a value read.
  
              (prompt-read (lambda (Prompt)
  
                    (display Prompt)
                    (read)))
  
              ; This function recursively computes the new
              ; balance given an initial balance init and
              ; a new value t.  Termination occurs when the
              ; new value is 0.
  
              (newbal (lambda (Init t)
                    (if (= t 0)
                        (list FB Init)
                        (transaction (+ Init t)))))
  
              ; This function prompts for and reads the next
              ; transaction and passes the information to newbal
  
              (transaction (lambda (Init)
                        (newbal Init (prompt-read AT)))))
  
  ; This is the body of checkbook;  it prompts for the
  ; starting balance
  
    (transaction (prompt-read IB)))))
  </code></pre>
  
  <h1>C# Console</h1>
  
  <pre class="lang-cs prettyprint-override"><code>using static System.Console;
  
  // This check book balancing program was written to illustrate
  // a Scheme example translated as closely as possible to C# Console
  namespace CheckBookFromSchemeExample
  {
      // These definitions are local to checkbook
      class Program
      {
          // These strings are used as prompts
  
          static string IB = "Enter initial balance: ";
          static string AT = "Enter transaction (- for withdrawal): ";
          static string FB = "Your final balance is: ";
  
          //this function displays a prompt then returns
          // a value read.
  
          static decimal prompt_read(string Prompt)
          {
              decimal result;
              WriteLine(Prompt);
              decimal.TryParse(ReadLine(), out result);
              return result;
          }
  
          //This function recursively computes the new
          // balance given an initial balance init and
          // a new value t. Termination occurs when the
          // new value is 0.
  
          static decimal newbal(decimal Init, decimal t)
          {
              if (t == 0)
              {
                  WriteLine(FB + Init.ToString("c"));
                  return (Init);
              }
              else
              {
                  decimal result = Init + t;
                  WriteLine(result.ToString("c"));
                  return transaction(result);
              }
          }
  
          // This function prompts for and reads the next
          // transaction and passes the information to newbal
          static decimal transaction(decimal Init)
          {
              return newbal(Init, prompt_read(AT));
          }
  
          // This is the body of the checkbook; it prompts for the
          // starting balance
  
          static void Main(string[] args)
          {
              transaction(prompt_read(IB));
              ReadLine();
          }
      }
  }
  </code></pre>
  
  <p>The translation to <strong>APL</strong> is left as an exercise for the reader. (no one expects them to do that!) (precisely)</p>
  
Answers.ContentLicense: CC BY-SA 3.0
Answers.CreationDate: 2018-03-20T19:34:23.967Z
Answers.Text: Welcome to CSEducators and thanks for your post. I think that illustrating by starting with a Scheme program and showing it in some other language is probably the best path for this sort of thing, rather than the opposite. That way the new language has cleaner code and if the translation is "messy" it can illustrate the power of the new paradigm. Showing messy Scheme would be counterproductive.
Answers.UserDisplayName: Buffy
Answers.ContentLicense: CC BY-SA 4.0
Answers.CreationDate: 2018-03-20T18:24:06.843Z
Answers.LastActivityDate: 2018-08-30T17:58:52.337Z
Answers.LastEditDate: 2018-08-30T17:58:52.337Z
Answers.UserDisplayName: user4730
Answers.Body: <p>philipxy's comment is correct.  There is one true language: mathematics.  Just explain what you are doing to your students, without using <em>any</em> computer language.  If it's confusing them in one language, why double the confusion, rather than eliminate it altogether?</p>
  
  <p>Except for maybe a small example here or there, the answer is No, you should not be venturing into procedural programming (I assume that's what you mean when you say C#) when teaching a functional programming class.</p>
  
  <p>There are only two programming paradigms: functional and procedural.  (And no, OO is not one of them.)</p>
  
  <p>The <strong>purpose</strong> of teaching functional programming is to teach students to think in terms of building a circuit, that is, a black box function of other black box functions, <strong>without state</strong> (otherwise known as global variables), and also to teach complex recursion (again without state).</p>
  
  <p>The idea of eliminating state is to teach students that a computer program is nothing more than just one big function, and that's it.</p>
  
Answers.ContentLicense: CC BY-SA 4.0
Answers.CreationDate: 2019-02-27T01:23:37.653Z
Answers.Text: Your definition of "programming paradigm" is not commonly accepted.  Please see [programming paradigms](https://en.wikipedia.org/wiki/Programming_paradigm).  Many of them are inter-compatible, including both OOP with functional programming and OOP with procedural programming.
Answers.UserDisplayName: Ben I.
Answers.ContentLicense: CC BY-SA 4.0
Answers.CreationDate: 2019-02-27T21:19:04.510Z
Answers.Text: I think the customary duality is functional/imperative--not functional/procedural. I also think you've possibly misapprehended a few other concepts as well.  State is not "otherwise known as global variables"--at least not for any definition of state I've ever seen.
Answers.UserDisplayName: Onorio Catenacci
Answers.ContentLicense: CC BY-SA 4.0
Answers.CreationDate: 2019-03-02T14:04:54.040Z
Answers.Text: Comments may only be edited for five minutes?  What in the world?  Little dictators.  The people who run this site have never changed their mind or made an edit after five minutes?  This site is weird.
Answers.UserDisplayName: Johnny
Answers.ContentLicense: CC BY-SA 4.0
Answers.CreationDate: 2019-03-02T14:06:18.210Z
Answers.Text: State is most definitely another way of saying global variables. Maybe functional vs imperative is a better way of saying functional vs procedural, but the purpose of teaching functional is still about lack of state, as I clearly stated in my post. Being that OO is not a real concept for any practical (nor even theoretical) purposes, I have no response for anyone who uses OO. It is becoming increasingly clear to me that the state of CS education is in a quagmire, and the people here seem to have some very funny ideas about CS, Math, and Logic.
Answers.UserDisplayName: Johnny
Answers.ContentLicense: CC BY-SA 4.0
Answers.CreationDate: 2022-02-01T10:45:28.680Z
Answers.Text: wouldn't they have to learn yet another grammar in this case?
Answers.UserDisplayName: Rainb
Answers.ContentLicense: CC BY-SA 4.0
Answers.CreationDate: 2019-02-27T00:36:37.983Z
Answers.LastActivityDate: 2019-02-27T03:37:04.507Z
Answers.LastEditDate: 2019-02-27T03:37:04.507Z
Answers.UserDisplayName: Johnny
Answers.Body: <p>Here I think the teacher's instinct and experience is the best judgement. You know your own students best. Your worry, of course, is well founded, especially since the two languages are so different. </p>
  
  <p>Learning to think functionally is a big deal and a mind expander. In some ways doing it cold-turkey (with no support) is good to do, since the students need to just thrash about until the see the A-Ha. But that can be very frustrating. It isn't good to leave your students frustrated, of course. </p>
  
  <p>Another reason for <em>not</em> using the technique you suggest is that you don't want their functional code to be just misspelled C#, using ideas from imperative and/or object-oriented thought patterns. Code in one language based on knowledge of another can be truly ugly and the programmer can miss the elegance of the new language. </p>
  
  <p>And functional program can be truly elegant and mind expanding. </p>
  
  <p>To balance the trade-off you can, of course, use "Rosetta Coding" only sparingly. And only when it seems really needed. Perhaps you could start out without it at all and use it only in situations in which the students are struggling, rather than as a main-line technique. You could also use it only when working with individuals (office hours) rather than with the larger group if a student needs to be reminded of the basic structure of an algorithm. Personally, I wouldn't use it as the main structure of the course and am happy to let my students thrash a bit in mildly turbulent waters. But that needs limits also, of course. </p>
  
  <p>Salt is fine, but don't over-salt. Judgment and a bit of restraint, perhaps. </p>
  
  <hr>
  
  <p>Since the two languages are from different paradigms the difference in resulting code can be quite stark. For example, reversing a list in linear time in Scheme is quite a lot different than you would likely program it in C# with mutable data. But even Java and Ruby, closely aligned, are <em>not</em> the same language and have different thought  patterns. It is the thought patterns that are the most important lessons of the various paradigms. </p>
  
Answers.ContentLicense: CC BY-SA 3.0
Answers.CreationDate: 2018-03-19T13:36:05.167Z
Answers.Text: Glad to see you follow what I'm asking @Buffy.  I was beginning to despair of anyone understanding exactly how different FP is from the imperative OO, C Family languages that dominate these days.
Answers.UserDisplayName: Onorio Catenacci
Answers.ContentLicense: CC BY-SA 3.0
Answers.CreationDate: 2018-03-22T00:48:58.257Z
Answers.Text: With static methods, the linq namespace, and lambda expression support, you can go pretty far with c# to show FP principles, at least through applicative FP concepts. These might be segways into teaching more lisp-y ideas in their current language proficiency before introducing the ideas in scheme.
Answers.UserDisplayName: Jed Schneider
Answers.ContentLicense: CC BY-SA 3.0
Answers.CreationDate: 2018-03-19T13:12:20.747Z
Answers.LastActivityDate: 2018-03-19T13:12:20.747Z
Answers.UserDisplayName: Buffy
Body: <p>When working to teach developers <code>Scheme</code> (which is functional programming) I'll often show them analogous examples in <code>C#</code>.  The idea is that by seeing something familiar it will make it easier for the students to understand the unfamiliar.  But I'm not sure that this may actually be causing more confusion to the students.  Any thoughts or suggestions on the wisdom (or lack thereof) of showing parallel code samples when teaching developers?</p>
  
  <p>By the way, <a href="http://www.rosettacode.org/wiki/Rosetta_Code" rel="nofollow noreferrer">this</a> is what I'm referring to by the phrase "Rosetta Code" in the question title. It's analogous to the idea of the <a href="https://en.wikipedia.org/wiki/Rosetta_Stone" rel="nofollow noreferrer">Rosetta Stone</a> presenting the same text in multiple languages. </p>
  
  <h2>EDIT</h2>
  
  <p>In case it wasn't clear from original question I was thinking of both the aspects of compare and contrast between languages (i. e. this is how we code a loop in C#, this is how we code it in Scheme) and the aspect of relating the unfamiliar (Scheme) by comparing it with the familiar (C#). </p>
  
Comments.ContentLicense: CC BY-SA 3.0
Comments.CreationDate: 2018-03-27T02:42:47.727Z
Comments.Text: There is one true language, and it is mathematics. You cannot even precisely & clearly explain what any of the programs in any of the languages do without giving a rule to translate a program into math. That math of the semantics is the simplest possible way to explain what any program is doing. (The primary notion is of a mapping.) It is only, sadly, because languages & programming are taught [sic] *without* explicit semantics that reminscent variations in other languages are even sought for clarification. Forget analogies, explain what is actually going on.
Comments.UserDisplayName: philipxy
Comments.ContentLicense: CC BY-SA 3.0
Comments.CreationDate: 2018-03-27T18:41:52.593Z
Comments.Text: I think you're very much in danger of wandering into the realm of the sesquipedalian. Saying that mathematics is the one true language may be true (if a tad reductive) but it's hardly helpful. By the way I don't think I've ever seen anyone use the adverb *sic* in reference to his or her own words.
Comments.UserDisplayName: Onorio Catenacci
Comments.ContentLicense: CC BY-SA 3.0
Comments.CreationDate: 2018-03-28T02:27:03.223Z
Comments.Text: I used relevant technical & everyday terms appropriately. You say you want to "teach" effectively. Then you could google based on my comment.
Comments.UserDisplayName: philipxy
Comments.ContentLicense: CC BY-SA 4.0
Comments.CreationDate: 2018-05-23T16:15:46.790Z
Comments.Text: If others see this question, this [blog post](https://cacm.acm.org/blogs/blog-cacm/228006-teaching-two-programming-languages-in-the-first-cs-course/fulltext) has some relevance.
Comments.UserDisplayName: Onorio Catenacci
Comments.ContentLicense: CC BY-SA 4.0
Comments.CreationDate: 2019-03-01T04:11:35.123Z
Comments.Text: @philipxy Very little of programming today is math. Screen aesthetics occupies 50% or more of an application's budget. Even machine learning, which at its core is statistical modeling, has been reduced to "use this library to construct a neural net, and use a particular function from that library to apply the bias function". Sadly, I spend a lot of my time chasing scope errors in the definition of Spring beans.
Comments.UserDisplayName: pojo-guy
Tags: <best-practice><teaching-analogy>
Title: How Effective Is "Rosetta Code" as a Teaching Technique?
ThreadText: # How Effective Is "Rosetta Code" as a Teaching Technique?
  
  (Asked by: username_0 on 2018-03-19)
  
  When working to teach developers `Scheme` (which is functional programming) I'll often show them analogous examples in `C#`. The idea is that by seeing something familiar it will make it easier for the students to understand the unfamiliar. But I'm not sure that this may actually be causing more confusion to the students. Any thoughts or suggestions on the wisdom (or lack thereof) of showing parallel code samples when teaching developers?
  
  By the way, [this](http://www.rosettacode.org/wiki/Rosetta_Code) is what I'm referring to by the phrase "Rosetta Code" in the question title. It's analogous to the idea of the [Rosetta Stone](https://en.wikipedia.org/wiki/Rosetta_Stone) presenting the same text in multiple languages.
  
  ## EDIT
  
  In case it wasn't clear from original question I was thinking of both the aspects of compare and contrast between languages (i. e. this is how we code a loop in C#, this is how we code it in Scheme) and the aspect of relating the unfamiliar (Scheme) by comparing it with the familiar (C#).
  
  **Tags:** best-practice, teaching-analogy
  
  > **Comments:**
  > **username_1**: There is one true language, and it is mathematics. You cannot even precisely & clearly explain what any of the programs in any of the languages do without giving a rule to translate a program into math. That math of the semantics is the simplest possible way to explain what any program is doing. (The primary notion is of a mapping.) It is only, sadly, because languages & programming are taught [sic] *without* explicit semantics that reminscent variations in other languages are even sought for clarification. Forget analogies, explain what is actually going on.  
  > **username_0**: I think you're very much in danger of wandering into the realm of the sesquipedalian. Saying that mathematics is the one true language may be true (if a tad reductive) but it's hardly helpful. By the way I don't think I've ever seen anyone use the adverb *sic* in reference to his or her own words.  
  > **username_1**: I used relevant technical & everyday terms appropriately. You say you want to "teach" effectively. Then you could google based on my comment.  
  > **username_0**: If others see this question, this [blog post](https://cacm.acm.org/blogs/blog-cacm/228006-teaching-two-programming-languages-in-the-first-cs-course/fulltext) has some relevance.  
  > **username_2**: @username_1 Very little of programming today is math. Screen aesthetics occupies 50% or more of an application's budget. Even machine learning, which at its core is statistical modeling, has been reduced to "use this library to construct a neural net, and use a particular function from that library to apply the bias function". Sadly, I spend a lot of my time chasing scope errors in the definition of Spring beans.  
  
  ---
  
  ## 5 answers
  
  ### Answer by username_7 on 2018-03-19. Score: 7 | Accepted answer
  
  Here I think the teacher's instinct and experience is the best judgement. You know your own students best. Your worry, of course, is well founded, especially since the two languages are so different.
  
  Learning to think functionally is a big deal and a mind expander. In some ways doing it cold-turkey (with no support) is good to do, since the students need to just thrash about until the see the A-Ha. But that can be very frustrating. It isn't good to leave your students frustrated, of course.
  
  Another reason for *not* using the technique you suggest is that you don't want their functional code to be just misspelled C#, using ideas from imperative and/or object-oriented thought patterns. Code in one language based on knowledge of another can be truly ugly and the programmer can miss the elegance of the new language.
  
  And functional program can be truly elegant and mind expanding.
  
  To balance the trade-off you can, of course, use "Rosetta Coding" only sparingly. And only when it seems really needed. Perhaps you could start out without it at all and use it only in situations in which the students are struggling, rather than as a main-line technique. You could also use it only when working with individuals (office hours) rather than with the larger group if a student needs to be reminded of the basic structure of an algorithm. Personally, I wouldn't use it as the main structure of the course and am happy to let my students thrash a bit in mildly turbulent waters. But that needs limits also, of course.
  
  Salt is fine, but don't over-salt. Judgment and a bit of restraint, perhaps.
  
  ---
  
  Since the two languages are from different paradigms the difference in resulting code can be quite stark. For example, reversing a list in linear time in Scheme is quite a lot different than you would likely program it in C# with mutable data. But even Java and Ruby, closely aligned, are *not* the same language and have different thought patterns. It is the thought patterns that are the most important lessons of the various paradigms.
  
  > **Comments:**
  > **username_0**: Glad to see you follow what I'm asking @username_7.  I was beginning to despair of anyone understanding exactly how different FP is from the imperative OO, C Family languages that dominate these days.  
  > **username_11**: With static methods, the linq namespace, and lambda expression support, you can go pretty far with c# to show FP principles, at least through applicative FP concepts. These might be segways into teaching more lisp-y ideas in their current language proficiency before introducing the ideas in scheme.  
  
  ---
  
  ### Answer by username_3 on 2018-05-18. Score: 2
  
  Using C# (or some other OOP or procedural language) as example for the inherently recursion-based Scheme is harmful. You need to (re)learn how to program to grok Scheme, different languages are just a distraction.
  
  Never forget the saying of "FORTRAN with semicolons" for much of the Pascal written in the beginning. Yes, contrasting different solutions in languages from varying paradigms is enlightening... *if you know the relevant languages/paradigms beforehand*.
  
  > **Comments:**
  > **username_0**: Teaching Scheme from first principles to developers that already know C# will require them to unlearn quite a bit regardless.  I'm not sure that showing them the C# version is that harmful--especially if one sticks to very isolated code fragments of C#  
  
  ---
  
  ### Answer by username_4 on 2018-03-20. Score: 2
  
  A Rosetta Stone is a temping way of thinking about the issue, and it works if the person knows *two* languages already (the way that we knew two of the languages on the Rosetta Stone and were trying to learn the third one). This is similar to how if you have two points of reference on a map, you can triangulate to locate a third.
  
  But those first two languages are going to be holy hell to learn. That is because no Rosetta Stone exists if you haven't learned one language, let alone two. Fortunately, we learn to speak when we are babies, everything is irritating anyway, and we forget the whole thing! If only we started to program when we were 2. Maybe future generations will...
  
  I started off sitting in front of a terminal hooked to a PDP-11, using either a shell script language or Basic, I forget which. When I could, I used one of the Apple ][s with Basic, until I got one myself in high school. I learned a smattering of Assembly then also. My first college course was in APL. From the standpoint of Basic and Assembly, this is Hieroglyphics indeed. Next we learned Lisp. It was all Greek to me for a while, some students never mastered it and washed out. None of these languages had anything in common, any more than Cuneiform, Linear-B and Hieroglyphics do, beyond the idea that: *"we want the computer to do something."*
  
  That is not much to go on. Really, the only analogy shared by all forms of computing is: "we want the computer to do something." And people are just so creative in coming up with ever-more varied ways of forming such utterances. (Perhaps we should try standardizing a bit instead?) (Shh! You'll ruin the story)
  
  All I can say is, keep throwing stuff at them, and if they can stay afloat, they might decide to make a living at it.
  
  > **Comments:**
  > **username_0**: Well in my case in particular I'm teaching professional developers who already know C#; I'm attempting to teach them Scheme.  So it's not quite as dire as trying to teach people who've never coded two languages at the same time. :)  
  > **username_5**: @username_0, if they're already familiar with .Net, maybe you should teach them F# before Scheme?  
  
  ---
  
  ### Answer by username_6 on 2018-03-20. Score: 2
  
  I swiped a **Scheme** example from [a tutorial](https://classes.soe.ucsc.edu/cmps112/Spring03/languages/scheme/SchemeTutorialA.html) and created my own translation to a **C# Console** program. I tried to preserve the structure, naming and comments. The difference in length is mostly due to the placement of curly braces on separate lines vs the parens on same lines.
  
  We could criticize the C# code by saying that it has to be sprinkled liberally with 'static' and 'decimal', but then would have to explain how much is *missing* from the Scheme example: The Lisp Interpreter (the entire concept of an interpreter...) and the built-in handling of numeric types therein.
  
  # Scheme
  
  ```lisp
  (define checkbook (lambda ()
  
  ; This check book balancing program was written to illustrate
  ; i/o in Scheme. It uses the purely functional part of Scheme.
  
          ; These definitions are local to checkbook
          (letrec
  
              ; These strings are used as prompts
  
             ((IB "Enter initial balance: ")
              (AT "Enter transaction (- for withdrawal): ")
              (FB "Your final balance is: ")
  
              ; This function displays a prompt then returns
              ; a value read.
  
              (prompt-read (lambda (Prompt)
  
                    (display Prompt)
                    (read)))
  
              ; This function recursively computes the new
              ; balance given an initial balance init and
              ; a new value t.  Termination occurs when the
              ; new value is 0.
  
              (newbal (lambda (Init t)
                    (if (= t 0)
                        (list FB Init)
                        (transaction (+ Init t)))))
  
              ; This function prompts for and reads the next
              ; transaction and passes the information to newbal
  
              (transaction (lambda (Init)
                        (newbal Init (prompt-read AT)))))
  
  ; This is the body of checkbook;  it prompts for the
  ; starting balance
  
    (transaction (prompt-read IB)))))
  
  ```
  
  # C# Console
  
  ```cs
  using static System.Console;
  
  // This check book balancing program was written to illustrate
  // a Scheme example translated as closely as possible to C# Console
  namespace CheckBookFromSchemeExample
  {
      // These definitions are local to checkbook
      class Program
      {
          // These strings are used as prompts
  
          static string IB = "Enter initial balance: ";
          static string AT = "Enter transaction (- for withdrawal): ";
          static string FB = "Your final balance is: ";
  
          //this function displays a prompt then returns
          // a value read.
  
          static decimal prompt_read(string Prompt)
          {
              decimal result;
              WriteLine(Prompt);
              decimal.TryParse(ReadLine(), out result);
              return result;
          }
  
          //This function recursively computes the new
          // balance given an initial balance init and
          // a new value t. Termination occurs when the
          // new value is 0.
  
          static decimal newbal(decimal Init, decimal t)
          {
              if (t == 0)
              {
                  WriteLine(FB + Init.ToString("c"));
                  return (Init);
              }
              else
              {
                  decimal result = Init + t;
                  WriteLine(result.ToString("c"));
                  return transaction(result);
              }
          }
  
          // This function prompts for and reads the next
          // transaction and passes the information to newbal
          static decimal transaction(decimal Init)
          {
              return newbal(Init, prompt_read(AT));
          }
  
          // This is the body of the checkbook; it prompts for the
          // starting balance
  
          static void Main(string[] args)
          {
              transaction(prompt_read(IB));
              ReadLine();
          }
      }
  }
  
  ```
  
  The translation to **APL** is left as an exercise for the reader. (no one expects them to do that!) (precisely)
  
  > **Comments:**
  > **username_7**: Welcome to CSEducators and thanks for your post. I think that illustrating by starting with a Scheme program and showing it in some other language is probably the best path for this sort of thing, rather than the opposite. That way the new language has cleaner code and if the translation is "messy" it can illustrate the power of the new paradigm. Showing messy Scheme would be counterproductive.  
  
  ---
  
  ### Answer by username_8 on 2019-02-27. Score: -2
  
  username_1's comment is correct. There is one true language: mathematics. Just explain what you are doing to your students, without using *any* computer language. If it's confusing them in one language, why double the confusion, rather than eliminate it altogether?
  
  Except for maybe a small example here or there, the answer is No, you should not be venturing into procedural programming (I assume that's what you mean when you say C#) when teaching a functional programming class.
  
  There are only two programming paradigms: functional and procedural. (And no, OO is not one of them.)
  
  The **purpose** of teaching functional programming is to teach students to think in terms of building a circuit, that is, a black box function of other black box functions, **without state** (otherwise known as global variables), and also to teach complex recursion (again without state).
  
  The idea of eliminating state is to teach students that a computer program is nothing more than just one big function, and that's it.
  
  > **Comments:**
  > **username_9**: Your definition of "programming paradigm" is not commonly accepted.  Please see [programming paradigms](https://en.wikipedia.org/wiki/Programming_paradigm).  Many of them are inter-compatible, including both OOP with functional programming and OOP with procedural programming.  
  > **username_0**: I think the customary duality is functional/imperative--not functional/procedural. I also think you've possibly misapprehended a few other concepts as well.  State is not "otherwise known as global variables"--at least not for any definition of state I've ever seen.  
  > **username_8**: Comments may only be edited for five minutes?  What in the world?  Little dictators.  The people who run this site have never changed their mind or made an edit after five minutes?  This site is weird.  
  > **username_8**: State is most definitely another way of saying global variables. Maybe functional vs imperative is a better way of saying functional vs procedural, but the purpose of teaching functional is still about lack of state, as I clearly stated in my post. Being that OO is not a real concept for any practical (nor even theoretical) purposes, I have no response for anyone who uses OO. It is becoming increasingly clear to me that the state of CS education is in a quagmire, and the people here seem to have some very funny ideas about CS, Math, and Logic.  
  > **username_10**: wouldn't they have to learn yet another grammar in this case?  
  
  ---
  
  