<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0"
	xmlns:content="http://purl.org/rss/1.0/modules/content/"
	xmlns:wfw="http://wellformedweb.org/CommentAPI/"
	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/"
	xmlns:slash="http://purl.org/rss/1.0/modules/slash/"
	xmlns:georss="http://www.georss.org/georss" xmlns:geo="http://www.w3.org/2003/01/geo/wgs84_pos#" xmlns:media="http://search.yahoo.com/mrss/"
	>

<channel>
	<title>JCranky&#039;s Blog!</title>
	<atom:link href="http://jcranky.com/feed/" rel="self" type="application/rss+xml" />
	<link>http://jcranky.com</link>
	<description>Java, Scala, Agile and stuff, by JCranky =)</description>
	<lastBuildDate>Wed, 23 May 2012 13:48:24 +0000</lastBuildDate>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.com/</generator>
<cloud domain='jcranky.com' port='80' path='/?rsscloud=notify' registerProcedure='' protocol='http-post' />
<image>
		<url>http://0.gravatar.com/blavatar/a2edfd1ac837f723e9b475c8eb5a5bbd?s=96&#038;d=http%3A%2F%2Fs2.wp.com%2Fi%2Fbuttonw-com.png</url>
		<title>JCranky&#039;s Blog!</title>
		<link>http://jcranky.com</link>
	</image>
	<atom:link rel="search" type="application/opensearchdescription+xml" href="http://jcranky.com/osd.xml" title="JCranky&#039;s Blog!" />
	<atom:link rel='hub' href='http://jcranky.com/?pushpress=hub'/>
		<item>
		<title>a small store application in scala, with play and akka</title>
		<link>http://jcranky.com/2012/05/23/a-small-store-application-in-scala-with-play-and-akka/</link>
		<comments>http://jcranky.com/2012/05/23/a-small-store-application-in-scala-with-play-and-akka/#comments</comments>
		<pubDate>Wed, 23 May 2012 03:39:41 +0000</pubDate>
		<dc:creator>Paulo "JCranky" Siqueira</dc:creator>
				<category><![CDATA[scala]]></category>
		<category><![CDATA[akka]]></category>
		<category><![CDATA[auction]]></category>
		<category><![CDATA[github]]></category>
		<category><![CDATA[lojinha]]></category>
		<category><![CDATA[play framework]]></category>

		<guid isPermaLink="false">http://jcranky.com/?p=1003</guid>
		<description><![CDATA[I&#8217;ve been promising some people that I would put a personal project I&#8217;m working on available on github. I wanted to have it done and usable before doing that, but since I always get delayed by something, I decided to make the source code available right away. So I did this last week and you [...]<img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=jcranky.com&#038;blog=4406641&#038;post=1003&#038;subd=jcranky&#038;ref=&#038;feed=1" width="1" height="1" />]]></description>
			<content:encoded><![CDATA[<p>I&#8217;ve been promising some people that I would put a personal project I&#8217;m working on available on github. I wanted to have it done and usable before doing that, but since I always get delayed by something, I decided to make the source code available right away. So I did this last week and <a title="Lojinha in Github" href="http://github.com/jcranky/lojinha" target="_blank">you can find it here</a>. It is called &#8220;lojinha&#8221;, which stands for something like &#8220;small store&#8221; in Portuguese.</p>
<p>The goal of the project is to implement a personal auction system, so that I can sell my used stuff I don&#8217;t want anymore. As of now, the project uses Play Framework 2.0 and Akka. Slow tasks like image thumb generation are delegated to akka actors. Also, the whole project is written in Scala, my current language of heart.</p>
<p>I&#8217;m still choosing where I&#8217;m going to deploy my instance when the project is ready, but I&#8217;ll publish a link here when it happens, so that you can buy something if you want =). It will probably be <a title="Amazon EC2" href="http://aws.amazon.com/ec2/" target="_blank">Amazen EC2</a> or <a title="Heroku" href="http://www.heroku.com/" target="_blank">Heroku</a>.</p>
<p>Finally, all feedback is welcome!</p>
<br />  <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gocomments/jcranky.wordpress.com/1003/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/comments/jcranky.wordpress.com/1003/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godelicious/jcranky.wordpress.com/1003/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/delicious/jcranky.wordpress.com/1003/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gofacebook/jcranky.wordpress.com/1003/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/facebook/jcranky.wordpress.com/1003/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gotwitter/jcranky.wordpress.com/1003/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/twitter/jcranky.wordpress.com/1003/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gostumble/jcranky.wordpress.com/1003/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/stumble/jcranky.wordpress.com/1003/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godigg/jcranky.wordpress.com/1003/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/digg/jcranky.wordpress.com/1003/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/goreddit/jcranky.wordpress.com/1003/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/reddit/jcranky.wordpress.com/1003/" /></a> <img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=jcranky.com&#038;blog=4406641&#038;post=1003&#038;subd=jcranky&#038;ref=&#038;feed=1" width="1" height="1" />]]></content:encoded>
			<wfw:commentRss>http://jcranky.com/2012/05/23/a-small-store-application-in-scala-with-play-and-akka/feed/</wfw:commentRss>
		<slash:comments>4</slash:comments>
	
		<media:content url="http://1.gravatar.com/avatar/3ebbb64cafa4d784a6f09a1886eaa5e7?s=96&#38;d=identicon&#38;r=G" medium="image">
			<media:title type="html">paulosiqueira</media:title>
		</media:content>
	</item>
		<item>
		<title>Slides from my Akka presentation at Just Java 2012</title>
		<link>http://jcranky.com/2012/05/19/slides-from-my-akka-presentation-at-just-java-2012/</link>
		<comments>http://jcranky.com/2012/05/19/slides-from-my-akka-presentation-at-just-java-2012/#comments</comments>
		<pubDate>Sun, 20 May 2012 02:25:17 +0000</pubDate>
		<dc:creator>Paulo "JCranky" Siqueira</dc:creator>
				<category><![CDATA[java]]></category>
		<category><![CDATA[scala]]></category>
		<category><![CDATA[akka]]></category>
		<category><![CDATA[just java]]></category>

		<guid isPermaLink="false">http://jcranky.com/?p=1001</guid>
		<description><![CDATA[I just uploaded the slides from the Akka presentation I did at Just Java 2012. You can find them here. The slides are in portuguese because the audience were brazilians, of course By the way, the conference was really nice and I&#8217;ll probably write a post about it in the next few days.<img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=jcranky.com&#038;blog=4406641&#038;post=1001&#038;subd=jcranky&#038;ref=&#038;feed=1" width="1" height="1" />]]></description>
			<content:encoded><![CDATA[<p>I just uploaded the slides from the Akka presentation I did at Just Java 2012. <a title="Slides Akka - Just Java 2012" href="http://www.slideshare.net/jcranky/akka-no-just-java-2012" target="_blank">You can find them here.</a> The slides are in portuguese because the audience were brazilians, of course <img src='http://s1.wp.com/wp-includes/images/smilies/icon_wink.gif' alt=';)' class='wp-smiley' /> </p>
<p>By the way, the conference was really nice and I&#8217;ll probably write a post about it in the next few days.</p>
<br />  <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gocomments/jcranky.wordpress.com/1001/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/comments/jcranky.wordpress.com/1001/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godelicious/jcranky.wordpress.com/1001/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/delicious/jcranky.wordpress.com/1001/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gofacebook/jcranky.wordpress.com/1001/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/facebook/jcranky.wordpress.com/1001/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gotwitter/jcranky.wordpress.com/1001/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/twitter/jcranky.wordpress.com/1001/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gostumble/jcranky.wordpress.com/1001/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/stumble/jcranky.wordpress.com/1001/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godigg/jcranky.wordpress.com/1001/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/digg/jcranky.wordpress.com/1001/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/goreddit/jcranky.wordpress.com/1001/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/reddit/jcranky.wordpress.com/1001/" /></a> <img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=jcranky.com&#038;blog=4406641&#038;post=1001&#038;subd=jcranky&#038;ref=&#038;feed=1" width="1" height="1" />]]></content:encoded>
			<wfw:commentRss>http://jcranky.com/2012/05/19/slides-from-my-akka-presentation-at-just-java-2012/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
	
		<media:content url="http://1.gravatar.com/avatar/3ebbb64cafa4d784a6f09a1886eaa5e7?s=96&#38;d=identicon&#38;r=G" medium="image">
			<media:title type="html">paulosiqueira</media:title>
		</media:content>
	</item>
		<item>
		<title>Akka at Just Java 2012 in São Paulo</title>
		<link>http://jcranky.com/2012/05/16/akka-at-just-java-2012-in-sao-paulo/</link>
		<comments>http://jcranky.com/2012/05/16/akka-at-just-java-2012-in-sao-paulo/#comments</comments>
		<pubDate>Wed, 16 May 2012 17:02:23 +0000</pubDate>
		<dc:creator>Paulo "JCranky" Siqueira</dc:creator>
				<category><![CDATA[java]]></category>
		<category><![CDATA[scala]]></category>
		<category><![CDATA[akka]]></category>
		<category><![CDATA[events]]></category>
		<category><![CDATA[just java]]></category>
		<category><![CDATA[vertical scaling]]></category>

		<guid isPermaLink="false">http://jcranky.com/?p=999</guid>
		<description><![CDATA[This weekend, 18th and 19th of May, will hold the Just Java 2012 conference down here in São Paulo, Brazil. If you are in the area, please drop by. This year, I&#8217;ll give a presentation about Akka 2.0 &#8211; mainly focusing on vertical scaling. I don&#8217;t have the talk completely done yet, so if you [...]<img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=jcranky.com&#038;blog=4406641&#038;post=999&#038;subd=jcranky&#038;ref=&#038;feed=1" width="1" height="1" />]]></description>
			<content:encoded><![CDATA[<p>This weekend, 18th and 19th of May, will hold the <a title="Just Java 2012" href="http://justjava.soujava.org.br/" target="_blank">Just Java 2012</a> conference down here in São Paulo, Brazil. If you are in the area, please drop by.</p>
<p>This year, I&#8217;ll give a presentation about <a title="Akka" href="http://akka.io/" target="_blank">Akka 2.0</a> &#8211; mainly focusing on vertical scaling. I don&#8217;t have the talk completely done yet, so if you have something you would like to see, please get in touch. Otherwise, see you there!</p>
<br />  <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gocomments/jcranky.wordpress.com/999/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/comments/jcranky.wordpress.com/999/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godelicious/jcranky.wordpress.com/999/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/delicious/jcranky.wordpress.com/999/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gofacebook/jcranky.wordpress.com/999/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/facebook/jcranky.wordpress.com/999/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gotwitter/jcranky.wordpress.com/999/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/twitter/jcranky.wordpress.com/999/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gostumble/jcranky.wordpress.com/999/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/stumble/jcranky.wordpress.com/999/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godigg/jcranky.wordpress.com/999/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/digg/jcranky.wordpress.com/999/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/goreddit/jcranky.wordpress.com/999/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/reddit/jcranky.wordpress.com/999/" /></a> <img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=jcranky.com&#038;blog=4406641&#038;post=999&#038;subd=jcranky&#038;ref=&#038;feed=1" width="1" height="1" />]]></content:encoded>
			<wfw:commentRss>http://jcranky.com/2012/05/16/akka-at-just-java-2012-in-sao-paulo/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
	
		<media:content url="http://1.gravatar.com/avatar/3ebbb64cafa4d784a6f09a1886eaa5e7?s=96&#38;d=identicon&#38;r=G" medium="image">
			<media:title type="html">paulosiqueira</media:title>
		</media:content>
	</item>
		<item>
		<title>Scala 99 Problems on github</title>
		<link>http://jcranky.com/2012/03/16/scala-99-problems-on-github/</link>
		<comments>http://jcranky.com/2012/03/16/scala-99-problems-on-github/#comments</comments>
		<pubDate>Fri, 16 Mar 2012 23:07:12 +0000</pubDate>
		<dc:creator>Paulo "JCranky" Siqueira</dc:creator>
				<category><![CDATA[scala]]></category>
		<category><![CDATA[github]]></category>
		<category><![CDATA[programming]]></category>
		<category><![CDATA[repository]]></category>
		<category><![CDATA[scala 99 problems]]></category>
		<category><![CDATA[specs2]]></category>

		<guid isPermaLink="false">http://jcranky.com/?p=988</guid>
		<description><![CDATA[A long time ago I started playing with the scala 99 problems. The project is going very slow, but it is moving. So I decided to share the code in a more open and easier way: github. I have solutions for the first 6 problems there, and will be updating as I move along. The [...]<img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=jcranky.com&#038;blog=4406641&#038;post=988&#038;subd=jcranky&#038;ref=&#038;feed=1" width="1" height="1" />]]></description>
			<content:encoded><![CDATA[<p>A long time ago I started playing with the <a title="Scala 99 Problems" href="http://aperiodic.net/phil/scala/s-99/" target="_blank">scala 99 problems</a>. The project is going very slow, but it is moving. So I decided to share the code in a more open and easier way: github. I have solutions for the first 6 problems there, and will be updating as I move along.</p>
<p><a title="Scala 99 Problems on Github" href="https://github.com/jcranky/scala99" target="_blank">The repository can be found here.</a></p>
<p>If you have extra solutions for the problems that are already there, feel free to do a pull request. For now, I&#8217;ll be accepting only pull requests for problems I already solved somehow, since my goal is the try them myself before looking at other people&#8217;s solutions.</p>
<p>For you test-fanatics out there, all the code is test-driven, using <a title="specs2" href="http://etorreborre.github.com/specs2/" target="_blank">specs2</a> =)</p>
<br />  <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gocomments/jcranky.wordpress.com/988/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/comments/jcranky.wordpress.com/988/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godelicious/jcranky.wordpress.com/988/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/delicious/jcranky.wordpress.com/988/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gofacebook/jcranky.wordpress.com/988/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/facebook/jcranky.wordpress.com/988/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gotwitter/jcranky.wordpress.com/988/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/twitter/jcranky.wordpress.com/988/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gostumble/jcranky.wordpress.com/988/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/stumble/jcranky.wordpress.com/988/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godigg/jcranky.wordpress.com/988/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/digg/jcranky.wordpress.com/988/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/goreddit/jcranky.wordpress.com/988/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/reddit/jcranky.wordpress.com/988/" /></a> <img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=jcranky.com&#038;blog=4406641&#038;post=988&#038;subd=jcranky&#038;ref=&#038;feed=1" width="1" height="1" />]]></content:encoded>
			<wfw:commentRss>http://jcranky.com/2012/03/16/scala-99-problems-on-github/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
	
		<media:content url="http://1.gravatar.com/avatar/3ebbb64cafa4d784a6f09a1886eaa5e7?s=96&#38;d=identicon&#38;r=G" medium="image">
			<media:title type="html">paulosiqueira</media:title>
		</media:content>
	</item>
		<item>
		<title>Why dynamic languages are not cool</title>
		<link>http://jcranky.com/2012/02/14/why-dynamic-languages-are-not-cool/</link>
		<comments>http://jcranky.com/2012/02/14/why-dynamic-languages-are-not-cool/#comments</comments>
		<pubDate>Tue, 14 Feb 2012 11:16:47 +0000</pubDate>
		<dc:creator>Paulo "JCranky" Siqueira</dc:creator>
				<category><![CDATA[scala]]></category>
		<category><![CDATA[dynamic]]></category>
		<category><![CDATA[dynamic language]]></category>
		<category><![CDATA[dynamic languages]]></category>
		<category><![CDATA[interpreter]]></category>
		<category><![CDATA[python]]></category>
		<category><![CDATA[static]]></category>
		<category><![CDATA[static language]]></category>
		<category><![CDATA[type]]></category>

		<guid isPermaLink="false">http://jcranky.com/?p=980</guid>
		<description><![CDATA[Some people love dynamic languages. I don&#8217;t. This last week, I found one more reason for it. I might be a bit biased because I love Scala, but lets go for it. A project I started maintaining a few weeks ago is written in python. I don&#8217;t know much python yet, so there is this [...]<img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=jcranky.com&#038;blog=4406641&#038;post=980&#038;subd=jcranky&#038;ref=&#038;feed=1" width="1" height="1" />]]></description>
			<content:encoded><![CDATA[<p>Some people love dynamic languages. I don&#8217;t. This last week, I found one more reason for it. I might be a bit biased because I love Scala, but lets go for it.</p>
<p>A project I started maintaining a few weeks ago is written in python. I don&#8217;t know much python yet, so there is this fact in and by itself. And I must say I&#8217;m liking the language. Now, the fact that it is dynamic has already bitten me at least twice.</p>
<p>In one of those, I was trying to understand why a test I just wrote was not working. It was as if one line was being simply ignored&#8230; Well, looks like I discovered by accident that I can call methods that doesn&#8217;t exist, at least on some objects or classes. I had a misspelled method name. As soon as that was fixed, everything worked fine. Half an hour lost with a problem that the compiler / interpreter should really warn me about.</p>
<p>The other case was a property in an object that simply disappeared. At a certain point in a function, it was there. A few lines later, in the SAME function, it was not anymore. At least this time it was simple to find the problem: a reassignment was being made, which was changing the type of the object.</p>
<p>Again: changing the type of the object. With an assignment. Yes, from a static language lover, this just feels absurd. There is no way this was going to happen in a statically typed language.</p>
<p>Lets end this rant on a positive note. I am liking python. Still, I would like it much more if it was statically typed.</p>
<p>By the way, we are going to have a new scaladores meeting in Sao Paulo on Feb. 23th. If you are in the region by then, please stop by. <a title="4a Reunião dos Scaladores" href="http://scaladores.com.br/2012/02/14/4a-reuniao-scaladores-23-de-fevereiro-de-2012-na-adaptworks/" target="_blank">More information (portuguese) here</a>.</p>
<br />  <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gocomments/jcranky.wordpress.com/980/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/comments/jcranky.wordpress.com/980/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godelicious/jcranky.wordpress.com/980/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/delicious/jcranky.wordpress.com/980/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gofacebook/jcranky.wordpress.com/980/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/facebook/jcranky.wordpress.com/980/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gotwitter/jcranky.wordpress.com/980/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/twitter/jcranky.wordpress.com/980/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gostumble/jcranky.wordpress.com/980/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/stumble/jcranky.wordpress.com/980/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godigg/jcranky.wordpress.com/980/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/digg/jcranky.wordpress.com/980/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/goreddit/jcranky.wordpress.com/980/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/reddit/jcranky.wordpress.com/980/" /></a> <img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=jcranky.com&#038;blog=4406641&#038;post=980&#038;subd=jcranky&#038;ref=&#038;feed=1" width="1" height="1" />]]></content:encoded>
			<wfw:commentRss>http://jcranky.com/2012/02/14/why-dynamic-languages-are-not-cool/feed/</wfw:commentRss>
		<slash:comments>2</slash:comments>
	
		<media:content url="http://1.gravatar.com/avatar/3ebbb64cafa4d784a6f09a1886eaa5e7?s=96&#38;d=identicon&#38;r=G" medium="image">
			<media:title type="html">paulosiqueira</media:title>
		</media:content>
	</item>
		<item>
		<title>Matching a combination of class and trait in Scala</title>
		<link>http://jcranky.com/2011/12/19/matching-a-combination-of-class-and-trait-in-scala/</link>
		<comments>http://jcranky.com/2011/12/19/matching-a-combination-of-class-and-trait-in-scala/#comments</comments>
		<pubDate>Mon, 19 Dec 2011 18:43:57 +0000</pubDate>
		<dc:creator>Paulo "JCranky" Siqueira</dc:creator>
				<category><![CDATA[scala]]></category>
		<category><![CDATA[AnyRef]]></category>
		<category><![CDATA[case]]></category>
		<category><![CDATA[class]]></category>
		<category><![CDATA[match]]></category>
		<category><![CDATA[pattern matching]]></category>
		<category><![CDATA[trait]]></category>
		<category><![CDATA[with]]></category>

		<guid isPermaLink="false">http://jcranky.com/?p=952</guid>
		<description><![CDATA[While doing some development with Scala I discovered that it is possible to match combinations of a class and traits. It might seem obvious if you already know it, but I didn&#8217;t. What happened is that I needed something like matching that kind of combination&#8230; and this speaks to something about Scala that I love: [...]<img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=jcranky.com&#038;blog=4406641&#038;post=952&#038;subd=jcranky&#038;ref=&#038;feed=1" width="1" height="1" />]]></description>
			<content:encoded><![CDATA[<p>While doing some development with Scala I discovered that it is possible to match combinations of a class and traits. It might seem obvious if you already know it, but I didn&#8217;t.</p>
<p>What happened is that I needed something like matching that kind of combination&#8230; and this speaks to something about Scala that I love: it becomes intuitive after a while. So how did I find that such matching is possible? I simply tried&#8230; =)</p>
<p>This is what this feature looks like:</p>
<p><pre class="brush: scala;">
msg match {
  case x: X with Z =&gt; println(&quot;matching combination!&quot;)
}
</pre></p>
<p>In this case, X would be a class, and Z a trait. The <em>case x</em> will be triggered only if <em>msg</em> is an instance of <em>class X</em> and mixes in <em>trait Z</em>. With this, we make sure to have access to all members both from the class and from the trait, while being really type safe about the matching. No unsupported combinations will pass through, and no need for castings, like would be necessary in Java.</p>
<p>Lets try a dummy example. Imagine we have a <em>Superman</em> class, and two traits: <em>BlueCape</em> and <em>RedCape</em>, like the following code:</p>
<p><pre class="brush: scala;">
class Superman(val realname: String)
trait BlueCape
trait RedCape
</pre></p>
<p>Now, we want to match on a Superman instance, but we want to know if it is fake or not. Finally, we also want to print the guy&#8217;s name, which means we need access to the <em>realname</em> field. This is how you could do that:</p>
<p><pre class="brush: scala;">
def whichSuperman(superman: AnyRef) = superman match {
  case s: Superman with RedCape =&gt; println(&quot;real superman: &quot; + s.realname)
  case f: Superman with BlueCape =&gt; println(&quot;fake superman: &quot; + f.realname)
}
</pre></p>
<p>Flexible and type safe! And if the traits had any field, we would be able to access them as well. Quick sample test code:</p>
<p><pre class="brush: scala;">
val mys = new Superman(&quot;clark&quot;) with RedCape
val myf = new Superman(&quot;clurk&quot;) with BlueCape

whichSuperman(mys)
whichSuperman(myf)
</pre></p>
<p>The part that matches the class is not very useful in this example, since this could be defined in the function parameter, but it was in my local scenario, where we are using actors and the messages can be <em>AnyRef</em>.</p>
<p>If you want to know a bit more about pattern matching, <a title="Scala Pattern Matching" href="http://jcranky.com/2010/04/29/scala-pattern-matching-the-reason-to-fall-in-love-with-scala/" target="_blank">I wrote about it a while ago here</a>. I also described <a title="Matching a range of numbers" href="http://jcranky.com/2011/03/17/matching-a-range-of-numbers-in-scala/" target="_blank">how to match a range of numbers here</a>.</p>
<br />  <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gocomments/jcranky.wordpress.com/952/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/comments/jcranky.wordpress.com/952/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godelicious/jcranky.wordpress.com/952/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/delicious/jcranky.wordpress.com/952/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gofacebook/jcranky.wordpress.com/952/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/facebook/jcranky.wordpress.com/952/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gotwitter/jcranky.wordpress.com/952/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/twitter/jcranky.wordpress.com/952/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gostumble/jcranky.wordpress.com/952/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/stumble/jcranky.wordpress.com/952/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godigg/jcranky.wordpress.com/952/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/digg/jcranky.wordpress.com/952/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/goreddit/jcranky.wordpress.com/952/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/reddit/jcranky.wordpress.com/952/" /></a> <img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=jcranky.com&#038;blog=4406641&#038;post=952&#038;subd=jcranky&#038;ref=&#038;feed=1" width="1" height="1" />]]></content:encoded>
			<wfw:commentRss>http://jcranky.com/2011/12/19/matching-a-combination-of-class-and-trait-in-scala/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
	
		<media:content url="http://1.gravatar.com/avatar/3ebbb64cafa4d784a6f09a1886eaa5e7?s=96&#38;d=identicon&#38;r=G" medium="image">
			<media:title type="html">paulosiqueira</media:title>
		</media:content>
	</item>
		<item>
		<title>scaladores first meeting</title>
		<link>http://jcranky.com/2011/11/08/scaladores-first-meeting/</link>
		<comments>http://jcranky.com/2011/11/08/scaladores-first-meeting/#comments</comments>
		<pubDate>Tue, 08 Nov 2011 13:24:00 +0000</pubDate>
		<dc:creator>Paulo "JCranky" Siqueira</dc:creator>
				<category><![CDATA[scala]]></category>
		<category><![CDATA[meeting]]></category>
		<category><![CDATA[sao paulo]]></category>
		<category><![CDATA[scaladores]]></category>

		<guid isPermaLink="false">http://jcranky.com/?p=948</guid>
		<description><![CDATA[Right to the point: we are starting a Scala user group down  here in São Paulo, called Scaladores. The idea is to for people interested in the Scala language to meet in person and talk about it. If you are in the region, please drop by &#8211; the first meeting happens this thurday, at 7pm. [...]<img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=jcranky.com&#038;blog=4406641&#038;post=948&#038;subd=jcranky&#038;ref=&#038;feed=1" width="1" height="1" />]]></description>
			<content:encoded><![CDATA[<p>Right to the point: we are starting a Scala user group down  here in São Paulo, called <em>Scaladores</em>. The idea is to for people interested in the Scala language to meet in person and talk about it. If you are in the region, please drop by &#8211; the first meeting happens this thurday, at 7pm. The portuguese page with <a title="Scaladores first meeting" href="http://scaladores.com.br/2011/11/07/1a-reuniao-scaladores-10-de-novembro-de-2011-na-adaptworks/" target="_blank">more information can be found here</a>.</p>
<p>I&#8217;ll come back after the meeting for a &#8216;report&#8217; of how it went =)</p>
<p>In time: I should write more posts about scala soon, just need to get some stuff in place before that.</p>
<br />  <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gocomments/jcranky.wordpress.com/948/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/comments/jcranky.wordpress.com/948/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godelicious/jcranky.wordpress.com/948/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/delicious/jcranky.wordpress.com/948/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gofacebook/jcranky.wordpress.com/948/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/facebook/jcranky.wordpress.com/948/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gotwitter/jcranky.wordpress.com/948/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/twitter/jcranky.wordpress.com/948/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gostumble/jcranky.wordpress.com/948/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/stumble/jcranky.wordpress.com/948/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godigg/jcranky.wordpress.com/948/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/digg/jcranky.wordpress.com/948/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/goreddit/jcranky.wordpress.com/948/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/reddit/jcranky.wordpress.com/948/" /></a> <img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=jcranky.com&#038;blog=4406641&#038;post=948&#038;subd=jcranky&#038;ref=&#038;feed=1" width="1" height="1" />]]></content:encoded>
			<wfw:commentRss>http://jcranky.com/2011/11/08/scaladores-first-meeting/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
	
		<media:content url="http://1.gravatar.com/avatar/3ebbb64cafa4d784a6f09a1886eaa5e7?s=96&#38;d=identicon&#38;r=G" medium="image">
			<media:title type="html">paulosiqueira</media:title>
		</media:content>
	</item>
		<item>
		<title>Acidental scala upgrade with sbaz</title>
		<link>http://jcranky.com/2011/09/19/acidental-scala-upgrade-with-sbaz/</link>
		<comments>http://jcranky.com/2011/09/19/acidental-scala-upgrade-with-sbaz/#comments</comments>
		<pubDate>Mon, 19 Sep 2011 22:04:40 +0000</pubDate>
		<dc:creator>Paulo "JCranky" Siqueira</dc:creator>
				<category><![CDATA[scala]]></category>
		<category><![CDATA[netbeans]]></category>
		<category><![CDATA[package manager]]></category>
		<category><![CDATA[sbaz]]></category>
		<category><![CDATA[scala-library]]></category>
		<category><![CDATA[upgrade]]></category>

		<guid isPermaLink="false">http://jcranky.com/?p=942</guid>
		<description><![CDATA[And then I was playing around with the scala tools that come in the installation&#8217;s bin folder. There is something there called sbaz, and this name sounds so different that I just HAD to play with it to find out what it does. Lets first explain what I discovered later: what sbaz does. It is [...]<img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=jcranky.com&#038;blog=4406641&#038;post=942&#038;subd=jcranky&#038;ref=&#038;feed=1" width="1" height="1" />]]></description>
			<content:encoded><![CDATA[<p>And then I was playing around with the <a title="Scala Language" href="http://scala-lang.org" target="_blank">scala</a> tools that come in the installation&#8217;s bin folder. There is something there called <em>sbaz</em>, and this name sounds so different that I just HAD to play with it to find out what it does.</p>
<p>Lets first explain what I discovered later: what <em>sbaz</em> does. It is some kind of scala package manager for your local scala installation. If you issue a <em>sbaz available</em>, it will list all packages it is able to install for you, for example. Also, and this was the somewhat tricky part for me, it is able to upgrade all current packages to their latest versions, including the main scala stuff, like the scala-library.</p>
<p>This is all great.. as long as you don&#8217;t run <em>sbaz upgrade</em> by mistake. This happened some weeks ago to me&#8230; And I was lucky enough to not have any major problem. I was running scala 2.8.0 at the time, and 2.9.0 was already out. Result: I upgraded to scala 2.9.0 before I intended to&#8230; and one day before a speech I gave at a conference, where I presented plenty of scala code examples.</p>
<p>In the end all went well, but I had to update some sample code, and to upgrade the Netbeans scala plugin to the version that supports 2.9.0. The other option would be to erase the installation folder and install scala from scratch again, but I chose to use this &#8220;event&#8221; to upgrade to 2.9.0 for real =)</p>
<p>Bottom line: learn that scala has a very nice package manager tool called <em>sbaz</em>, but use it with care <img src='http://s1.wp.com/wp-includes/images/smilies/icon_wink.gif' alt=';)' class='wp-smiley' /> </p>
<br />  <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gocomments/jcranky.wordpress.com/942/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/comments/jcranky.wordpress.com/942/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godelicious/jcranky.wordpress.com/942/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/delicious/jcranky.wordpress.com/942/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gofacebook/jcranky.wordpress.com/942/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/facebook/jcranky.wordpress.com/942/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gotwitter/jcranky.wordpress.com/942/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/twitter/jcranky.wordpress.com/942/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gostumble/jcranky.wordpress.com/942/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/stumble/jcranky.wordpress.com/942/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godigg/jcranky.wordpress.com/942/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/digg/jcranky.wordpress.com/942/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/goreddit/jcranky.wordpress.com/942/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/reddit/jcranky.wordpress.com/942/" /></a> <img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=jcranky.com&#038;blog=4406641&#038;post=942&#038;subd=jcranky&#038;ref=&#038;feed=1" width="1" height="1" />]]></content:encoded>
			<wfw:commentRss>http://jcranky.com/2011/09/19/acidental-scala-upgrade-with-sbaz/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
	
		<media:content url="http://1.gravatar.com/avatar/3ebbb64cafa4d784a6f09a1886eaa5e7?s=96&#38;d=identicon&#38;r=G" medium="image">
			<media:title type="html">paulosiqueira</media:title>
		</media:content>
	</item>
		<item>
		<title>Scala&#8217;s Parallel Collections are useful even in the most simple cases</title>
		<link>http://jcranky.com/2011/08/26/scalas-parallel-collections-are-useful-even-in-the-most-simple-cases/</link>
		<comments>http://jcranky.com/2011/08/26/scalas-parallel-collections-are-useful-even-in-the-most-simple-cases/#comments</comments>
		<pubDate>Fri, 26 Aug 2011 23:58:09 +0000</pubDate>
		<dc:creator>Paulo "JCranky" Siqueira</dc:creator>
				<category><![CDATA[scala]]></category>
		<category><![CDATA[amazon]]></category>
		<category><![CDATA[amazon s3]]></category>
		<category><![CDATA[collections]]></category>
		<category><![CDATA[foreach]]></category>
		<category><![CDATA[par]]></category>
		<category><![CDATA[parallel collections]]></category>
		<category><![CDATA[s3]]></category>

		<guid isPermaLink="false">http://jcranky.com/?p=928</guid>
		<description><![CDATA[One of the main features that Scala version 2.9.x brought was Parallel Collections. If you think about it quickly, you might consider using such a feature only in complex, process intensive scenarios. Although those are certainly the main places where you would consider using parallel collections, there are more simpler ways you can leverage them. [...]<img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=jcranky.com&#038;blog=4406641&#038;post=928&#038;subd=jcranky&#038;ref=&#038;feed=1" width="1" height="1" />]]></description>
			<content:encoded><![CDATA[<p>One of the main features that Scala version 2.9.x brought was Parallel Collections. If you think about it quickly, you might consider using such a feature only in complex, process intensive scenarios.</p>
<p>Although those are certainly the main places where you would consider using parallel collections, there are more simpler ways you can leverage them. The code to use this feature is so simple that it&#8217;s easy to come up with reasons to use it everywhere:</p>
<p><pre class="brush: scala;">
myCol.par foreach(println)
</pre></p>
<p>Now how could that be easier??</p>
<p>So where did I use that for real, you might ask. The current company I work on stores files in Amazon S3. Before that, those files where stored in the local disk. So, when we migrated to S3, I wrote a script, in Scala, to upload all the files&#8230; thousands of them. My first solution looked something like this:</p>
<p><pre class="brush: scala;">
listOfFiles foreach(file =&gt; sendToS3(file))
</pre></p>
<p>And then suddenly it occurred me that it&#8217;s ridiculously simple to parallelize the upload of the files:</p>
<p><pre class="brush: scala;">
listOfFiles.par foreach(file =&gt; sendToS3(file))
</pre></p>
<p>Result: half the time for uploading the files, having to do almost nothing! Pretty neat, ain&#8217;t it?</p>
<br />  <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gocomments/jcranky.wordpress.com/928/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/comments/jcranky.wordpress.com/928/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godelicious/jcranky.wordpress.com/928/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/delicious/jcranky.wordpress.com/928/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gofacebook/jcranky.wordpress.com/928/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/facebook/jcranky.wordpress.com/928/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gotwitter/jcranky.wordpress.com/928/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/twitter/jcranky.wordpress.com/928/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gostumble/jcranky.wordpress.com/928/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/stumble/jcranky.wordpress.com/928/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godigg/jcranky.wordpress.com/928/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/digg/jcranky.wordpress.com/928/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/goreddit/jcranky.wordpress.com/928/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/reddit/jcranky.wordpress.com/928/" /></a> <img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=jcranky.com&#038;blog=4406641&#038;post=928&#038;subd=jcranky&#038;ref=&#038;feed=1" width="1" height="1" />]]></content:encoded>
			<wfw:commentRss>http://jcranky.com/2011/08/26/scalas-parallel-collections-are-useful-even-in-the-most-simple-cases/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
	
		<media:content url="http://1.gravatar.com/avatar/3ebbb64cafa4d784a6f09a1886eaa5e7?s=96&#38;d=identicon&#38;r=G" medium="image">
			<media:title type="html">paulosiqueira</media:title>
		</media:content>
	</item>
		<item>
		<title>Scala Problem Number Six</title>
		<link>http://jcranky.com/2011/08/21/scala-problem-number-six/</link>
		<comments>http://jcranky.com/2011/08/21/scala-problem-number-six/#comments</comments>
		<pubDate>Sun, 21 Aug 2011 04:40:53 +0000</pubDate>
		<dc:creator>Paulo "JCranky" Siqueira</dc:creator>
				<category><![CDATA[scala]]></category>
		<category><![CDATA[list]]></category>
		<category><![CDATA[list reverse]]></category>
		<category><![CDATA[list.head]]></category>
		<category><![CDATA[list.last]]></category>
		<category><![CDATA[palindrome]]></category>
		<category><![CDATA[s-99]]></category>
		<category><![CDATA[scala 99 problems]]></category>

		<guid isPermaLink="false">http://jcranky.com/?p=869</guid>
		<description><![CDATA[From the Scala 99 Problems, lets face the problem number six: P06 (*) Find out whether a list is a palindrome. Example: scala&#62; isPalindrome(List(1, 2, 3, 2, 1)) res0: Boolean = true The first thing I had to do was to find out the meaning of palindrome. From the example, it&#8217;s easy to guess, but [...]<img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=jcranky.com&#038;blog=4406641&#038;post=869&#038;subd=jcranky&#038;ref=&#038;feed=1" width="1" height="1" />]]></description>
			<content:encoded><![CDATA[<p>From the <a title="Scala 99 Problems" href="http://aperiodic.net/phil/scala/s-99/" target="_blank">Scala 99 Problems</a>, lets face the problem number six:</p>
<dl>
<dt><strong>P06 (*) Find out whether a list is a palindrome.</strong></dt>
<dd>Example:</p>
<pre>scala&gt; isPalindrome(List(1, 2, 3, 2, 1))
res0: Boolean = true</pre>
</dd>
</dl>
<p>The first thing I had to do was to find out the meaning of <em>palindrome</em>. From the example, it&#8217;s easy to guess, but I prefer to be sure. So, <a title="Palindrome at Dictionary.com" href="http://dictionary.reference.com/browse/palindrome" target="_blank">from dictionary.com</a>:</p>
<div><em>1. a word, line, verse, number, sentence, etc., reading the same backward as forward, as Madam, I&#8217;m Adam  or Poor Dan is in a droop.</em></div>
<p>Interesting, so this is valid not only for numbers =)</p>
<p>Now, to some coding! My first solution:</p>
<p><pre class="brush: scala;">
def isPalindrome(list: List[Any]): Boolean = list match {
  case Nil =&gt; true
  case head :: Nil =&gt; true
  case head :: rest if head == rest.last =&gt; isPalindrome(rest.dropRight(1))
  case _ =&gt; false
}
</pre></p>
<p>This first solution uses pattern matching to investigate the list recursively. It checks if the list is empty or if it contains only one element and returns true. Otherwise, it checks if the head of the list equals the last element. If so, the rest of the list (its middle part) is passed recursively to the function. This is one more case where we can see the great power of scala&#8217;s pattern matching in action.</p>
<p>Also, the solution will work with strings as well, so it matches the dictionary definition &#8211; just call <em>toList</em> on the string. Sample execution from the <em>REPL</em>:</p>
<p><pre class="brush: scala;">
scala&gt; isPalindrome(&quot;oio&quot;.toList)
res11: Boolean = true

scala&gt; isPalindrome(&quot;oioo&quot;.toList)
res12: Boolean = false
</pre></p>
<p>To be honest, I don&#8217;t feel too much creative when thinking about this problem, so the next solution is quite similar to the previous one, but without pattern matching:</p>
<p><pre class="brush: scala;">
def isPalindrome(list: List[Any]): Boolean = {
  if (list.isEmpty || list.size == 1) true
  else if (list.head == list.last) isPalindrome(list.slice(1, list.size-1))
  else false
}
</pre></p>
<p>Now lets take a look at the <a title="Scala Problem Number Six - Solution" href="http://aperiodic.net/phil/scala/s-99/p06.scala" target="_blank">original solution</a> and&#8230; I&#8217;m stunned by its simplicity. While I went all fancy at things like pattern matching, the original solution goes like this:</p>
<p><pre class="brush: scala;">
def isPalindrome[A](ls: List[A]): Boolean = ls == ls.reverse
</pre></p>
<p>Yeah, I should have thought of that&#8230;</p>
<br />  <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gocomments/jcranky.wordpress.com/869/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/comments/jcranky.wordpress.com/869/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godelicious/jcranky.wordpress.com/869/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/delicious/jcranky.wordpress.com/869/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gofacebook/jcranky.wordpress.com/869/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/facebook/jcranky.wordpress.com/869/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gotwitter/jcranky.wordpress.com/869/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/twitter/jcranky.wordpress.com/869/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gostumble/jcranky.wordpress.com/869/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/stumble/jcranky.wordpress.com/869/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godigg/jcranky.wordpress.com/869/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/digg/jcranky.wordpress.com/869/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/goreddit/jcranky.wordpress.com/869/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/reddit/jcranky.wordpress.com/869/" /></a> <img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=jcranky.com&#038;blog=4406641&#038;post=869&#038;subd=jcranky&#038;ref=&#038;feed=1" width="1" height="1" />]]></content:encoded>
			<wfw:commentRss>http://jcranky.com/2011/08/21/scala-problem-number-six/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
	
		<media:content url="http://1.gravatar.com/avatar/3ebbb64cafa4d784a6f09a1886eaa5e7?s=96&#38;d=identicon&#38;r=G" medium="image">
			<media:title type="html">paulosiqueira</media:title>
		</media:content>
	</item>
	</channel>
</rss>
