<?xml version="1.0" encoding="UTF-8"?><rss version="2.0"
	xmlns:content="http://purl.org/rss/1.0/modules/content/"
	xmlns:dc="http://purl.org/dc/elements/1.1/"
	xmlns:atom="http://www.w3.org/2005/Atom"
	xmlns:sy="http://purl.org/rss/1.0/modules/syndication/"
		>
<channel>
	<title>Comments on: Scala: 99 problems</title>
	<atom:link href="http://www.markhneedham.com/blog/2009/09/30/scala-99-problems/feed/" rel="self" type="application/rss+xml" />
	<link>http://www.markhneedham.com/blog/2009/09/30/scala-99-problems/</link>
	<description>Thoughts on Software Development</description>
	<lastBuildDate>Sat, 11 Feb 2012 23:17:00 +0000</lastBuildDate>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=3.3.1</generator>
	<item>
		<title>By: My Software Development journey: Year 3-4 at Mark Needham</title>
		<link>http://www.markhneedham.com/blog/2009/09/30/scala-99-problems/comment-page-1/#comment-23423</link>
		<dc:creator>My Software Development journey: Year 3-4 at Mark Needham</dc:creator>
		<pubDate>Mon, 05 Oct 2009 08:54:09 +0000</pubDate>
		<guid isPermaLink="false">http://www.markhneedham.com/blog/?p=1688#comment-23423</guid>
		<description>[...] recently Liz and I have been playing around with Scala and from trying out some of these exercises I am seeing that when writing recursive functions my [...]</description>
		<content:encoded><![CDATA[<p>[...] recently Liz and I have been playing around with Scala and from trying out some of these exercises I am seeing that when writing recursive functions my [...]</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Mark Needham</title>
		<link>http://www.markhneedham.com/blog/2009/09/30/scala-99-problems/comment-page-1/#comment-23245</link>
		<dc:creator>Mark Needham</dc:creator>
		<pubDate>Thu, 01 Oct 2009 08:09:48 +0000</pubDate>
		<guid isPermaLink="false">http://www.markhneedham.com/blog/?p=1688#comment-23245</guid>
		<description>@Raphael - man I always spot the tail recursion but I missed this one! Good point.

@Charlie - that solution reads quite well. I think it&#039;s possible to do a solution using the built in function &#039;flatMap&#039; which would make it even more concise.</description>
		<content:encoded><![CDATA[<p>@Raphael &#8211; man I always spot the tail recursion but I missed this one! Good point.</p>
<p>@Charlie &#8211; that solution reads quite well. I think it&#8217;s possible to do a solution using the built in function &#8216;flatMap&#8217; which would make it even more concise.</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Charlie Knudsen</title>
		<link>http://www.markhneedham.com/blog/2009/09/30/scala-99-problems/comment-page-1/#comment-23232</link>
		<dc:creator>Charlie Knudsen</dc:creator>
		<pubDate>Thu, 01 Oct 2009 02:02:38 +0000</pubDate>
		<guid isPermaLink="false">http://www.markhneedham.com/blog/?p=1688#comment-23232</guid>
		<description>I am still trying to wrap my head around functional programming in general.  I find the below solution to make the most sense to me:

    def flatten[A](list : List[A]) : List[A] =  {
      list.foldRight(Nil:List[A])((elem, start:List[A]) =&gt; {
          elem match {
            case x:List[A] =&gt;  flatten(x) ::: start
            case _  =&gt; elem :: start
          }
        }
      )
    }</description>
		<content:encoded><![CDATA[<p>I am still trying to wrap my head around functional programming in general.  I find the below solution to make the most sense to me:</p>
<p>    def flatten[A](list : List[A]) : List[A] =  {<br />
      list.foldRight(Nil:List[A])((elem, start:List[A]) =&gt; {<br />
          elem match {<br />
            case x:List[A] =&gt;  flatten(x) ::: start<br />
            case _  =&gt; elem :: start<br />
          }<br />
        }<br />
      )<br />
    }</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Raphael Speyer</title>
		<link>http://www.markhneedham.com/blog/2009/09/30/scala-99-problems/comment-page-1/#comment-23227</link>
		<dc:creator>Raphael Speyer</dc:creator>
		<pubDate>Wed, 30 Sep 2009 22:59:09 +0000</pubDate>
		<guid isPermaLink="false">http://www.markhneedham.com/blog/?p=1688#comment-23227</guid>
		<description>FWIW the second option is tail recursive, so it can deal with indefinitely long lists, whereas the third option will stack overflow given a long enough input.</description>
		<content:encoded><![CDATA[<p>FWIW the second option is tail recursive, so it can deal with indefinitely long lists, whereas the third option will stack overflow given a long enough input.</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Mark Needham</title>
		<link>http://www.markhneedham.com/blog/2009/09/30/scala-99-problems/comment-page-1/#comment-23221</link>
		<dc:creator>Mark Needham</dc:creator>
		<pubDate>Wed, 30 Sep 2009 20:07:31 +0000</pubDate>
		<guid isPermaLink="false">http://www.markhneedham.com/blog/?p=1688#comment-23221</guid>
		<description>@Hector - yeh that&#039;s a good point. I think that&#039;s probably a hang over from the fact that in the previous problems &#039;A&#039; could be a specific type but you&#039;re right for this problem it&#039;s irrelevant. 

@Oli - looking at the Prolog problems reminds me of university days!</description>
		<content:encoded><![CDATA[<p>@Hector &#8211; yeh that&#8217;s a good point. I think that&#8217;s probably a hang over from the fact that in the previous problems &#8216;A&#8217; could be a specific type but you&#8217;re right for this problem it&#8217;s irrelevant. </p>
<p>@Oli &#8211; looking at the Prolog problems reminds me of university days!</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Oli</title>
		<link>http://www.markhneedham.com/blog/2009/09/30/scala-99-problems/comment-page-1/#comment-23214</link>
		<dc:creator>Oli</dc:creator>
		<pubDate>Wed, 30 Sep 2009 16:46:43 +0000</pubDate>
		<guid isPermaLink="false">http://www.markhneedham.com/blog/?p=1688#comment-23214</guid>
		<description>Hehe &quot;not quite intuitive&quot; that&#039;s the word,
&quot;the solution is cleaner and easier to read&quot; that&#039;s the message.

I never thought I would dig up my old Prolog assignments and fundamental scripts (#07) from https://prof.ti.bfh.ch/hew1/informatik3/prolog/p-99/

Thank you for keeping me hooked on Scala!</description>
		<content:encoded><![CDATA[<p>Hehe &#8220;not quite intuitive&#8221; that&#8217;s the word,<br />
&#8220;the solution is cleaner and easier to read&#8221; that&#8217;s the message.</p>
<p>I never thought I would dig up my old Prolog assignments and fundamental scripts (#07) from <a href="https://prof.ti.bfh.ch/hew1/informatik3/prolog/p-99/" rel="nofollow">https://prof.ti.bfh.ch/hew1/informatik3/prolog/p-99/</a></p>
<p>Thank you for keeping me hooked on Scala!</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Hector Chu</title>
		<link>http://www.markhneedham.com/blog/2009/09/30/scala-99-problems/comment-page-1/#comment-23213</link>
		<dc:creator>Hector Chu</dc:creator>
		<pubDate>Wed, 30 Sep 2009 16:19:41 +0000</pubDate>
		<guid isPermaLink="false">http://www.markhneedham.com/blog/?p=1688#comment-23213</guid>
		<description>Is there any point in the type parameter A, as it will nearly always be deduced as type Any?</description>
		<content:encoded><![CDATA[<p>Is there any point in the type parameter A, as it will nearly always be deduced as type Any?</p>
]]></content:encoded>
	</item>
</channel>
</rss>

