<?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 for MarbleMice.com</title>
	<atom:link href="http://marblemice.com/comments/feed/" rel="self" type="application/rss+xml" />
	<link>http://marblemice.com</link>
	<description>Hacking the trees of knowledge.</description>
	<lastBuildDate>Mon, 07 Dec 2009 14:53:05 +0000</lastBuildDate>
	<generator>http://wordpress.org/?v=2.9.1</generator>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
		<item>
		<title>Comment on android:layout_weight and LinearLayout by kartaguez</title>
		<link>http://marblemice.com/2009/10/18/androidlayout_weight-and-linearlayout/comment-page-1/#comment-3799</link>
		<dc:creator>kartaguez</dc:creator>
		<pubDate>Mon, 07 Dec 2009 14:53:05 +0000</pubDate>
		<guid isPermaLink="false">http://marblemice.com/?p=514#comment-3799</guid>
		<description>Thanks a lot !!</description>
		<content:encoded><![CDATA[<p>Thanks a lot !!</p>
]]></content:encoded>
	</item>
	<item>
		<title>Comment on android:layout_weight and LinearLayout by gyller</title>
		<link>http://marblemice.com/2009/10/18/androidlayout_weight-and-linearlayout/comment-page-1/#comment-3573</link>
		<dc:creator>gyller</dc:creator>
		<pubDate>Sun, 22 Nov 2009 13:21:51 +0000</pubDate>
		<guid isPermaLink="false">http://marblemice.com/?p=514#comment-3573</guid>
		<description>Ah thanks, saved me a lot of trouble! ;)</description>
		<content:encoded><![CDATA[<p>Ah thanks, saved me a lot of trouble! ;)</p>
]]></content:encoded>
	</item>
	<item>
		<title>Comment on Scala Parsing Combinators Example by birdle</title>
		<link>http://marblemice.com/2008/10/14/scala-parsing-combinators-example/comment-page-1/#comment-3393</link>
		<dc:creator>birdle</dc:creator>
		<pubDate>Wed, 04 Nov 2009 20:29:53 +0000</pubDate>
		<guid isPermaLink="false">http://marblemice.com/?p=232#comment-3393</guid>
		<description>Thanks for your comments and addition code. The private types certainly help make the resulting code more readable.

After messing with various functional languages for quite some time it still pleases me to see how clear and concise languages like Scala and Haskell are for this type of problem  compared with C++ or Java.</description>
		<content:encoded><![CDATA[<p>Thanks for your comments and addition code. The private types certainly help make the resulting code more readable.</p>
<p>After messing with various functional languages for quite some time it still pleases me to see how clear and concise languages like Scala and Haskell are for this type of problem  compared with C++ or Java.</p>
]]></content:encoded>
	</item>
	<item>
		<title>Comment on Scala Parsing Combinators Example by John Dawson</title>
		<link>http://marblemice.com/2008/10/14/scala-parsing-combinators-example/comment-page-1/#comment-3205</link>
		<dc:creator>John Dawson</dc:creator>
		<pubDate>Tue, 03 Nov 2009 00:18:58 +0000</pubDate>
		<guid isPermaLink="false">http://marblemice.com/?p=232#comment-3205</guid>
		<description>Well, that last message got completely garbled by the comment input.  It looks like it got the start of the text I entered, and the last part, and deleted stuff in the middle.  Ouch.

I&#039;ll re-paste the key part of the code, the evaluator.

    private type Operation = ~[String, Double]             
    private type Expression = ~[Double, List[Operation]]   

    private def eval(value: Expression): Double = value match {
        case lhs~ops =&gt; (
            (lhs /: ops) ((acc, op) =&gt; op match {
                case &quot;+&quot;~rhs =&gt; acc + rhs
                case &quot;-&quot;~rhs =&gt; acc - rhs
                case &quot;*&quot;~rhs =&gt; acc * rhs
                case &quot;/&quot;~rhs =&gt; acc / rhs
            })
        )
    }

The private types aren&#039;t strictly necessary, but using them seemed more legible than declaring eval like this:

    private def eval(value: ~[Double,List[~[String,Double]]]): Double</description>
		<content:encoded><![CDATA[<p>Well, that last message got completely garbled by the comment input.  It looks like it got the start of the text I entered, and the last part, and deleted stuff in the middle.  Ouch.</p>
<p>I&#8217;ll re-paste the key part of the code, the evaluator.</p>
<p>    private type Operation = ~[String, Double]<br />
    private type Expression = ~[Double, List[Operation]]   </p>
<p>    private def eval(value: Expression): Double = value match {<br />
        case lhs~ops =&gt; (<br />
            (lhs /: ops) ((acc, op) =&gt; op match {<br />
                case &#8220;+&#8221;~rhs =&gt; acc + rhs<br />
                case &#8220;-&#8221;~rhs =&gt; acc &#8211; rhs<br />
                case &#8220;*&#8221;~rhs =&gt; acc * rhs<br />
                case &#8220;/&#8221;~rhs =&gt; acc / rhs<br />
            })<br />
        )<br />
    }</p>
<p>The private types aren&#8217;t strictly necessary, but using them seemed more legible than declaring eval like this:</p>
<p>    private def eval(value: ~[Double,List[~[String,Double]]]): Double</p>
]]></content:encoded>
	</item>
	<item>
		<title>Comment on Scala Parsing Combinators Example by John Dawson</title>
		<link>http://marblemice.com/2008/10/14/scala-parsing-combinators-example/comment-page-1/#comment-3204</link>
		<dc:creator>John Dawson</dc:creator>
		<pubDate>Tue, 03 Nov 2009 00:08:25 +0000</pubDate>
		<guid isPermaLink="false">http://marblemice.com/?p=232#comment-3204</guid>
		<description>Thanks for the code example.  I&#039;m new to Scala and I was having trouble taking the calculator example code in &quot;Programming in Scala&quot; and making it actually evaluate the input expression.  Your code revealed what the magic trick was.

After seeing your code, I still wanted make a calculator that evaluates the input directly, rather than building up an AST first.  Here&#039;s my code to do that.

import scala.util.parsing.combinator._

class Arith extends JavaTokenParsers {
    def expr: Parser[Double] =
        term~rep(&quot;+&quot;~term &#124; &quot;-&quot;~term) ^^ (eval(_))

    def term: Parser[Double] =
        factor~rep(&quot;*&quot;~factor &#124; &quot;/&quot;~factor) ^^ (eval(_))

    def factor: Parser[Double] = (
        floatingPointNumber ^^ (_.toDouble)
        &#124; &quot;(&quot;~&gt;expr (
            // Use left fold to reduce the list
            (lhs /: ops) ((acc, op) =&gt; op match {
                case &quot;+&quot;~rhs =&gt; acc + rhs
                case &quot;-&quot;~rhs =&gt; acc - rhs
                case &quot;*&quot;~rhs =&gt; acc * rhs
                case &quot;/&quot;~rhs =&gt; acc / rhs
            })
        )
    }
}

object Calc extends Arith {
    def main(args: Array[String]) {
        if (args.isEmpty)
            println(&quot;usage: scala Calc EXPRESSION&quot;)
        else
            println(parseAll(expr, args(0)))
    }
}</description>
		<content:encoded><![CDATA[<p>Thanks for the code example.  I&#8217;m new to Scala and I was having trouble taking the calculator example code in &#8220;Programming in Scala&#8221; and making it actually evaluate the input expression.  Your code revealed what the magic trick was.</p>
<p>After seeing your code, I still wanted make a calculator that evaluates the input directly, rather than building up an AST first.  Here&#8217;s my code to do that.</p>
<p>import scala.util.parsing.combinator._</p>
<p>class Arith extends JavaTokenParsers {<br />
    def expr: Parser[Double] =<br />
        term~rep(&#8220;+&#8221;~term | &#8220;-&#8221;~term) ^^ (eval(_))</p>
<p>    def term: Parser[Double] =<br />
        factor~rep(&#8220;*&#8221;~factor | &#8220;/&#8221;~factor) ^^ (eval(_))</p>
<p>    def factor: Parser[Double] = (<br />
        floatingPointNumber ^^ (_.toDouble)<br />
        | &#8220;(&#8220;~&gt;expr (<br />
            // Use left fold to reduce the list<br />
            (lhs /: ops) ((acc, op) =&gt; op match {<br />
                case &#8220;+&#8221;~rhs =&gt; acc + rhs<br />
                case &#8220;-&#8221;~rhs =&gt; acc &#8211; rhs<br />
                case &#8220;*&#8221;~rhs =&gt; acc * rhs<br />
                case &#8220;/&#8221;~rhs =&gt; acc / rhs<br />
            })<br />
        )<br />
    }<br />
}</p>
<p>object Calc extends Arith {<br />
    def main(args: Array[String]) {<br />
        if (args.isEmpty)<br />
            println(&#8220;usage: scala Calc EXPRESSION&#8221;)<br />
        else<br />
            println(parseAll(expr, args(0)))<br />
    }<br />
}</p>
]]></content:encoded>
	</item>
	<item>
		<title>Comment on The Haskell Indulgence by birdle</title>
		<link>http://marblemice.com/2009/10/24/the-haskell-indulgence/comment-page-1/#comment-3179</link>
		<dc:creator>birdle</dc:creator>
		<pubDate>Sun, 25 Oct 2009 21:04:01 +0000</pubDate>
		<guid isPermaLink="false">http://marblemice.com/?p=523#comment-3179</guid>
		<description>Thanks for the additional links. I was vaguely aware of the Industrial Haskell group but was not really aware of what had come thought it yet so didn&#039;t mention it.

Also noted my slight mix up with naming. Cabal is the build and packaging system and hackage is the actually repository. Oops. It is certainly good to see all the changes that have happened over the past couple of years.</description>
		<content:encoded><![CDATA[<p>Thanks for the additional links. I was vaguely aware of the Industrial Haskell group but was not really aware of what had come thought it yet so didn&#8217;t mention it.</p>
<p>Also noted my slight mix up with naming. Cabal is the build and packaging system and hackage is the actually repository. Oops. It is certainly good to see all the changes that have happened over the past couple of years.</p>
]]></content:encoded>
	</item>
	<item>
		<title>Comment on The Haskell Indulgence by donsbot</title>
		<link>http://marblemice.com/2009/10/24/the-haskell-indulgence/comment-page-1/#comment-3178</link>
		<dc:creator>donsbot</dc:creator>
		<pubDate>Sat, 24 Oct 2009 22:41:29 +0000</pubDate>
		<guid isPermaLink="false">http://marblemice.com/?p=523#comment-3178</guid>
		<description>You can keep up to date on the state of Hackage -- the Haskell central library repository -- with the monthly status reports: http://donsbot.wordpress.com/2009/08/29/haskell-popularity-rankings-september-2009/ (there are over 1600 libraries now, only a handful of which existed 2 years ago).

Secondly, you didn&#039;t mention one of the newest developments, the Industrial Haskell Group, http://industry.haskell.org/ , which supports the development of the language and tools for commercial users by funding direct development on the ecosystem. In the past year this has helped a lot with cabal, ghc and dynamic libraries, for example.</description>
		<content:encoded><![CDATA[<p>You can keep up to date on the state of Hackage &#8212; the Haskell central library repository &#8212; with the monthly status reports: <a href="http://donsbot.wordpress.com/2009/08/29/haskell-popularity-rankings-september-2009/" rel="nofollow">http://donsbot.wordpress.com/2009/08/29/haskell-popularity-rankings-september-2009/</a> (there are over 1600 libraries now, only a handful of which existed 2 years ago).</p>
<p>Secondly, you didn&#8217;t mention one of the newest developments, the Industrial Haskell Group, <a href="http://industry.haskell.org/" rel="nofollow">http://industry.haskell.org/</a> , which supports the development of the language and tools for commercial users by funding direct development on the ecosystem. In the past year this has helped a lot with cabal, ghc and dynamic libraries, for example.</p>
]]></content:encoded>
	</item>
	<item>
		<title>Comment on Multidimensional Arrays in Scala by birdle</title>
		<link>http://marblemice.com/2008/06/18/multidimensional-arrays-in-scala/comment-page-1/#comment-3086</link>
		<dc:creator>birdle</dc:creator>
		<pubDate>Tue, 06 Oct 2009 11:23:26 +0000</pubDate>
		<guid isPermaLink="false">http://marblemice.com/2008/06/17/multidimensional-arrays-in-scala/#comment-3086</guid>
		<description>Hey,

That is a good one, I had to fire up the scala interpreter to spot the mistake even with the hint. 

Reminds me of the classic C/C++ mistake I have seen in real code, it goes something like this.
&lt;code&gt;
    int x= SomeNumber();
    int Value1 = 10;
    int Value2 = 11;
    switch(x)
    {
      case Value1:
        doSomething();
        break;
      Value2:
        doSomethingElse();
        break;
     default:
        break;
    }
&lt;/code&gt;
Quite obviously in a small bit of code but hard to spot in production code.</description>
		<content:encoded><![CDATA[<p>Hey,</p>
<p>That is a good one, I had to fire up the scala interpreter to spot the mistake even with the hint. </p>
<p>Reminds me of the classic C/C++ mistake I have seen in real code, it goes something like this.<br />
<code><br />
    int x= SomeNumber();<br />
    int Value1 = 10;<br />
    int Value2 = 11;<br />
    switch(x)<br />
    {<br />
      case Value1:<br />
        doSomething();<br />
        break;<br />
      Value2:<br />
        doSomethingElse();<br />
        break;<br />
     default:<br />
        break;<br />
    }<br />
</code><br />
Quite obviously in a small bit of code but hard to spot in production code.</p>
]]></content:encoded>
	</item>
	<item>
		<title>Comment on Multidimensional Arrays in Scala by Jason Felice</title>
		<link>http://marblemice.com/2008/06/18/multidimensional-arrays-in-scala/comment-page-1/#comment-3083</link>
		<dc:creator>Jason Felice</dc:creator>
		<pubDate>Mon, 05 Oct 2009 19:22:23 +0000</pubDate>
		<guid isPermaLink="false">http://marblemice.com/2008/06/17/multidimensional-arrays-in-scala/#comment-3083</guid>
		<description>You&#039;ll be happy to know that it took me fifteen minutes to figure out why Scala was throwing very strange errors for:

val array = Array[Array[Int]](100, 100)

The error is &quot;type mismatch; found: Int(100); required: Array[Int]&quot;.

(Hint: I&#039;ve already got something old, something borrowed, and something blue...)</description>
		<content:encoded><![CDATA[<p>You&#8217;ll be happy to know that it took me fifteen minutes to figure out why Scala was throwing very strange errors for:</p>
<p>val array = Array[Array[Int]](100, 100)</p>
<p>The error is &#8220;type mismatch; found: Int(100); required: Array[Int]&#8220;.</p>
<p>(Hint: I&#8217;ve already got something old, something borrowed, and something blue&#8230;)</p>
]]></content:encoded>
	</item>
	<item>
		<title>Comment on Tired Mind Programming by birdle</title>
		<link>http://marblemice.com/2009/05/05/tired-mind-programming/comment-page-1/#comment-2186</link>
		<dc:creator>birdle</dc:creator>
		<pubDate>Wed, 06 May 2009 20:12:41 +0000</pubDate>
		<guid isPermaLink="false">http://marblemice.com/?p=397#comment-2186</guid>
		<description>Wow! I imagine the intersection between marathon runners and Clojure programmers is pretty small. My best time for a marathon is 3hrs 40mins so the photo of you beating the 3hr mark makes you a fair bit faster than me.</description>
		<content:encoded><![CDATA[<p>Wow! I imagine the intersection between marathon runners and Clojure programmers is pretty small. My best time for a marathon is 3hrs 40mins so the photo of you beating the 3hr mark makes you a fair bit faster than me.</p>
]]></content:encoded>
	</item>
</channel>
</rss>
