Archive for the ‘scala’ Category

Friday Scala Kata: Weekday Heptagram

Last week’s scala kata was a bit challenging as it required a bit more advanced scala knowledge than the katas I’ve done so far. Breaking from last week I’ve decided to head back to the basics and dream up a kata to help focus on some of scala’s language features versus a full blown program. [...]

Friday Scala Kata: Solitaire Cipher

This week’s scala kata is a favorite I’ve implemented before in javascript, Solitaire Cipher which was featured some time back as the first problem on the Ruby Quiz site. I think there should be enough source material on those two links to get started. The true acid test is being able to shuffle a deck [...]

Pascal’s Triangle Solution

Last night I completed this weeks Scala Kata to generate Pascal’s Triangle using a List of Lists. Although it works, I’d like to see if there is a better “scala way” to get it done. I’ve also discovered that List in scala is immutable so all those times I’m adding elements to the List I’m [...]

Revisiting Factorials in Scala

In my earlier post I showcased doing a simple factorial code kata using scala and today as I was driving home from work I was thinking… isn’t there some way to dynamically add methods to an object so that I can just write 10! and have it compute the factorial? The answer is yes, kind [...]

Friday Scala Kata: Pascal’s Triangle

This week’s Scala Kata was suggested to me by Tim Dalton. For a given number, build Pascal’s Triangle as a List of Lists starting from the top down. Here’s some examples to illustrate: Given n = 1, then the result should be List(List(1)) Given n = 2, then the result should be List(List(1), List(1,1)) Given [...]

Scala Kata Triangle Words Solution

SInce it’s Friday I’ll post my solution to the previous Scala Kata, Identifying Triangle Words. I started by specifying small functions that could be combined to determine whether or not a word is a triangle word: import org.specs._ object TriangleWordIdentifierSpec extends Specification{ “letter to number converter” should { “convert A to 1″ in { convertLetterToNumber(‘A’) [...]

Follow up on the Scala Prime Factors Kata

So my fellow OCIer Tim Dalton took up my challenge to find me the “scala way” of implementing the solution in a nice one liner. I changed the example in the spec to allow a result of a list with 1 in it instead of an empty list to get rid of the conditional… the [...]

Scala Prime Factors Kata

So recently I started committing myself to understanding scala better and a perfect way of doing this is to start practicing different code katas in the language. So early this morning I started the day by doing the Prime Factors Kata in scala using specs to drive development and sbt to build run tests. The [...]

A Poor Man’s Guide to Getting Started With Scala

Want to get started with Scala, but not keen on using fancy IDEs nor have the cash to afford a nice Mac Powerbook and TextMate? Then this guide is for you! I’ll illustrate how to get a nifty scala development environment up and running on a system running Ubuntu with minimal hassle… and best of [...]

Subscribe to RSS Feed Follow me on Twitter!