Category: scala

  • Goldilocks actors: not too many, not too few

    After my last post on parallelism with Scala actors, I had a thought: when doing a calculation like this, am I actually making the most of my resources? If as in the Pi example, more cycles will generally lead to a better result, surely if I have a limited amount of time to get the […]

  • Better living through parallelism

    Judging by the interest to my last actors post, I thought I’d throw up a piece of code that uses actors anonymously to parallelise a long running operation. Not every operation can be parallelised, most things we work on tend to be fairly sequential. However, sometimes if you can split up the work to perform […]

  • Why I dig Scala: Concurrency and the Dining Philosophers

    I am occasionally asked what the big deal is about Scala. For me, to decide whether a programming language is worthwhile is dependent on two practical questions: does it aid comprehension, and does it reduce code. The two are not necessarily interchangeable. Terseness, after all, does nothing to aid comprehension. Scala scores points on both […]

  • Expressive or just terse?

    This Scala code populates a list with objects: So does this. If you’re a Java programmer and just balked, you’re probably not alone. I know what it does and I have to read it from left to right to left to right again. In this case the shortcut’s a Scala mental snag equivalent to Java […]

  • NoSuchMethodException launching Scala App

    This is a pretty standard thing to do in Java: So you reckon you’d be able to do this in Scala: You go to run it and: Exception in thread “main” java.lang.NoSuchMethodException: id.jakubkorab.App.main([Ljava.lang.String;) at java.lang.Class.getMethod(Class.java:1605) at com.intellij.rt.execution.application.AppMain.main(AppMain.java:107) Turns out the Scala compiler doesn’t treat application launching in the same way that it treats other classes […]

  • Running a Scala App in IDEA 9

    My first experience with IDEA hasn’t been a good one. In all fairness, not IDEA itself, but with a plugin (isn’t that always the way). I use Eclipse on a day to day basis, but since I heard that the IDEA Scala support is much better, I decided to download the Community Edition and give […]