<story><title>More functional C#</title><text>I added this code as a comment to a thread that was almost all the way off the front page by the time I got to it.  It was a response to some &amp;#x27;functional folks&amp;#x27; criticizing the verbosity of c#.  While you can certainly do c# the java way, you can also do it in a &lt;i&gt;near&lt;/i&gt; functional way.&lt;p&gt;I decided to post the code as a full submission because I think c# often gets dismissed as Java copy-cat, which hasn&amp;#x27;t been true in a decade.&lt;p&gt;The code (non-destructive, no side effects) calculates square roots :&lt;p&gt;&lt;pre&gt;&lt;code&gt;    public static void Main()
    {
        const int n = 21;

        Observable.Generate&amp;lt;double,double&amp;gt;(1, x=&amp;gt;true, x=&amp;gt; 0.5 * (x + (n&amp;#x2F;x)), x=&amp;gt;x )
        .Scan(new {prv = 0d, cur = 0d}, (prev, curr) =&amp;gt; new {prv = prev.cur, cur = curr})
        .FirstAsync(_ =&amp;gt; Math.Abs(_.cur - _.prv) &amp;lt; 1E-10)
        .Select(_ =&amp;gt; _.cur)
        .Subscribe(Console.WriteLine);

        &amp;#x2F;&amp;#x2F; this is just to compare values, so is not part of the solution
        Console.WriteLine(Math.Sqrt(n)); 
        Console.ReadLine();
    }
&lt;/code&gt;&lt;/pre&gt;
Read the more OO c# implementation that inspired me here:
https:&amp;#x2F;&amp;#x2F;news.ycombinator.com&amp;#x2F;item?id=7044497&lt;p&gt;Read the Haskell code that inspired both here:
https:&amp;#x2F;&amp;#x2F;news.ycombinator.com&amp;#x2F;item?id=7043943</text></story><parent_chain><item><author>Touche</author><text>But why do things &amp;quot;near functional&amp;quot; when you have F# which is fully functional?</text></item></parent_chain><comment><author>Sanddancer</author><text>This argument of purity of ideology reminds me more than a bit of the Salon system of French art. Unless your style was absolutely to their liking, your work was deemed refusé. Sometimes doing things in an imperative style, even with state and all the baggage that comes with it, results in easier to read and debug code.</text></comment>
<story><title>More functional C#</title><text>I added this code as a comment to a thread that was almost all the way off the front page by the time I got to it.  It was a response to some &amp;#x27;functional folks&amp;#x27; criticizing the verbosity of c#.  While you can certainly do c# the java way, you can also do it in a &lt;i&gt;near&lt;/i&gt; functional way.&lt;p&gt;I decided to post the code as a full submission because I think c# often gets dismissed as Java copy-cat, which hasn&amp;#x27;t been true in a decade.&lt;p&gt;The code (non-destructive, no side effects) calculates square roots :&lt;p&gt;&lt;pre&gt;&lt;code&gt;    public static void Main()
    {
        const int n = 21;

        Observable.Generate&amp;lt;double,double&amp;gt;(1, x=&amp;gt;true, x=&amp;gt; 0.5 * (x + (n&amp;#x2F;x)), x=&amp;gt;x )
        .Scan(new {prv = 0d, cur = 0d}, (prev, curr) =&amp;gt; new {prv = prev.cur, cur = curr})
        .FirstAsync(_ =&amp;gt; Math.Abs(_.cur - _.prv) &amp;lt; 1E-10)
        .Select(_ =&amp;gt; _.cur)
        .Subscribe(Console.WriteLine);

        &amp;#x2F;&amp;#x2F; this is just to compare values, so is not part of the solution
        Console.WriteLine(Math.Sqrt(n)); 
        Console.ReadLine();
    }
&lt;/code&gt;&lt;/pre&gt;
Read the more OO c# implementation that inspired me here:
https:&amp;#x2F;&amp;#x2F;news.ycombinator.com&amp;#x2F;item?id=7044497&lt;p&gt;Read the Haskell code that inspired both here:
https:&amp;#x2F;&amp;#x2F;news.ycombinator.com&amp;#x2F;item?id=7043943</text></story><parent_chain><item><author>Touche</author><text>But why do things &amp;quot;near functional&amp;quot; when you have F# which is fully functional?</text></item></parent_chain><comment><author>V-2</author><text>Because &amp;quot;near functional&amp;quot; is sufficient most of the time and if there is no compelling reason to split your codebase among two different languages, you shouldn&amp;#x27;t do it. Not to mention that there&amp;#x27;s probably 1000 C# developers for every F# developer&lt;p&gt;Have a look at &lt;a href=&quot;http://www.indeed.com/jobanalytics/jobtrends?q=c%23%2C+f%23&amp;amp;l=&quot; rel=&quot;nofollow&quot;&gt;http:&amp;#x2F;&amp;#x2F;www.indeed.com&amp;#x2F;jobanalytics&amp;#x2F;jobtrends?q=c%23%2C+f%23&amp;amp;...&lt;/a&gt;&lt;p&gt;And someone has to maintain your near functional or functional code</text></comment>