vote up
0
vote down

Towards generic APIs for the open world

In my last post on how Clojure protocols encourage open abstractions, I did some quick rounds between type classes in Haskell and protocols in Clojure. At the end in the section titled "Not really a type class", I mentioned about the read function of
tags: scala
Sep 03 2010 08:26 PM
vote up
0
vote down

Scala: Easier to read (and write), harder to understand?

There is a vivid discussion about Scala’s complexity going on for some weeks now on the web even with a response from Martin Odersky. I want to throw my 2¢ together with some hopefully new aspects into the discussion. Scala’s liberal syntax
Aug 31 2010 08:23 AM
vote up
0
vote down

Scala, object persistence, and the original NoSQL: XML

In our digitization wiki project based on Eclipse 4 and Scala it was time to find a persistence solution. As a quick overview of what it’s about, our app will basically allow a user to edit a digitized book page, showing the original scan as an
 
Fabian Steeg
Aug 30 2010 06:32 PM
vote up
0
vote down

Type-Level Programming in Scala, Part 6d: HList Zip/Unzip

For zip and unzip, we need to define some type classes. First, we will define an HZip type class that accepts two HLists and produces a zipped HList. sealed trait HZip[A <: HList, B <: HList, Result <: HList] { def apply(a: A, b: B): Result }
 
Mark
Jul 21 2010 01:30 AM
vote up
0
vote down

Type-Level Programming in Scala, Part 6c: HList Indexing

Next, we implement some indexing operations on HLists. We’d like to drop or take n elements, get the element at index i, split into two HLists around index i, and so forth. The idea is to take an HList and Nat and produce a zipper-like structure
 
Mark
Jul 13 2010 07:38 AM
vote up
0
vote down

Type-Level Programming in Scala, Part 6b: HList folds

We now build on our basic HList definition by implementing folds. We can then implement functions like append and reverse using these folds. Skip to the end if you want to see the examples first. Our folds will look very much like the folds for Nat. The
 
Mark
Jul 10 2010 04:24 AM
vote up
0
vote down

Scala is Unfit for Serious Development

Scala is Unfit for Serious Development (where serious means you want to make money from it, compared to a hobby). Fact. Because it’s object oriented? No. Because it’s functional? No. Because of the complex type system? No. Because of the love
 
stephan
tags: scala
Jul 10 2010 03:18 AM
vote up
0
vote down

Type-Level Programming in Scala, Part 6a: Heterogeneous List Basics

An HList is an arbitrary-length tuple. The advantages of an HList over the TupleX classes in the Scala standard library are that we are (in theory) not restricted to a fixed length and we do not need to duplicate methods for each tuple arity. We can
 
Mark
Jul 07 2010 10:23 AM
vote up
0
vote down

Higher-Rank Polymorphism in Scala

I was reading Tim Carstens’s post about Haskell features he’d like to see in other languages, and one of those features was rank-2 types. Tim says that the killer application for this to ensure the safety of resource access, in the type
 
Rúnar
Jul 02 2010 03:49 PM
vote up
0
vote down

Scala Expressiveness

At its heart, Mathematica has deep support for functional programming. As a computer algebra system, the functional programming support in Mathematica is unmatched in similar products, specifically, when it comes to pattern matching and rule based
 
thinkmeta
Jun 28 2010 08:40 AM
vote up
0
vote down

Mathematica Conference, Egypt 2010

Here are the slides of my recent talk at Mathematica Conference, Egypt 2010 Please leave a comment if you’re interested in the source notebook
 
thinkmeta
Jun 25 2010 02:48 AM
vote up
0
vote down

Type-Level Programming in Scala, Part 5a: Binary numbers

The Nat operations are generally limited to results under 10,000. Compilation time gets quite long or the stack overflows beyond that. An alternative is to use a binary representation of numbers, called Dense here after the implementation in
 
Mark
Jun 24 2010 10:38 PM
vote up
0
vote down

Type-Level Programming in Scala, Part 5b: Project Euler problem 4

Let’s look at solving Project Euler problem #4 at the type level. Since we are working with binary numbers in Scala’s type system, we have to substantially reduce our expectations for what we can solve. The first simplification is that we
 
Mark
Jun 24 2010 09:16 PM
vote up
0
vote down

Type-Level Programming in Scala, Part 4d: Peano arithmetic

Now we will use Nat#FoldR to define arithmetic on type-level natural numbers. Our type level functions and folds will follow the form of these value level functions. (In most cases, we are really just applying a function n times and not doing anything
 
Mark
Jun 22 2010 02:13 AM
vote up
0
vote down

Type-Level Programming in Scala, Part 4c: General recursion on Peano numbers

A core operation that we can use to define arithmetic operations is a fold on the list of integers from N down to _1 (so _0 is treated like an empty list). Using fold right and fold left, we can define operations like addition and multiplication. We add
 
Mark
Jun 21 2010 05:36 PM
vote up
0
vote down

Type-Level Programming in Scala, Part 4b: Comparing Peano numbers

Next, let’s look at comparing natural numbers. Define a Comparison type as follows: sealed trait Comparison { type Match[IfLT <: Up, IfEQ <: Up, IfGT <: Up, Up] <: Up type gt = Match[False, False, True, Bool] type ge = Match[False,
 
Mark
Jun 17 2010 06:53 PM
vote up
0
vote down

Type-Level Programming in Scala, Part 4a: Peano number basics

As mentioned in the opening post, we can do recursion at the type-level in Scala. The first application for this will be representing numbers in the type system (Peano numbers). One use of these is type-safe indexing into HLists, which we will do in a
 
Mark
Jun 16 2010 05:25 PM
vote up
0
vote down

Type-Level Programming in Scala, Part 3: Boolean

A good introductory example to type-level programming is the Church encoding of booleans. It doesn’t require anything too fancy and we need booleans when comparing numbers later. If you are already familiar with the Church encoding of booleans,
 
Mark
Jun 14 2010 06:13 AM
vote up
0
vote down

Type-Level Programming in Scala

(Contributed by Mark Harrah) This series is intended as a guided tour of some type-level programming I have done in Scala. It generally consists of code and examples with a few lines of explanation. It is usually assumed that the reader understands the
 
Rúnar
Jun 09 2010 11:00 AM
vote up
0
vote down

SBT: falling in love again

    The thing that’s true about me and Scala (the language, tools, approaches, frameworks, etc.) – this is a real love, but it has never been a love at first sight. I remember, when I met Scala the first time, it appeared
 
Vasil Remeniuk
Jun 05 2010 10:59 AM
vote up
0
vote down

Flexible load balancing with Akka in Scala

// // //     Scala concurrency is based on Actors paradigm. Actors communicate with each other sending messages and doesn’t share global state, which guarantees safe concurrency. Every actor has own mailbox the messages are added to,
 
Vasil Remeniuk
May 22 2010 05:04 AM
vote up
0
vote down

Intercepting Scala trait constructors

Today I was writing an AspectJ aspect for a Scala trait and was wondering why my constructor pointcut definition didn't work. Having a closer look at the Scala byte code together with my colleague Johan solved the puzzle. Here is what I did (using
 
Michael Kober
Apr 29 2010 12:10 AM
vote up
0
vote down

Extending the JDT

A couple of weeks ago I had a look at the Motodevstudio for Android developers and I think it has some quite nice features like code snippets or wizards for Android activities, services and more. Actually it's is quite easy to extend the eclipse JDT and
 
Michael Kober
Apr 20 2010 11:31 PM
vote up
0
vote down

Scala vs.Clojure, part 3 – the similarities

There is some more discussion of Scala vs. Clojure. With the Oracle deal, and some discussions about the slow Java 7 release, it looks like Java is detoriating faster not slower. So discussions about Java succession increase. I’ve discussed Scala
 
stephan
tags: scala
Apr 20 2010 05:40 PM
vote up
0
vote down

PubSub with Redis and Akka Actors

Redis (the version on the trunk) offers publish/subscribe based messaging. This is quite a big feature compared to the typical data structure oriented services that it had been offering so far. This also opens up lots of possibilities to use Redis as a
tags: scala
Apr 19 2010 08:29 AM
vote up
0
vote down

An Eclipse RCP digitization wiki with e4 and Scala

We have reached the first milestone of a new project I have been working on since November: an Eclipse RCP wiki application (implemented using e4 and Scala) to collaboratively improve the digitization of the Romansch Chrestomathy, a collection of
 
Fabian Steeg
Apr 19 2010 04:31 AM
vote up
0
vote down

Domain Services and Bounded Context using Akka - Part 2

In Part 1 of this series you saw how we can model a domain repository as an actor in Akka. It gives you declarative transaction semantics through Akka's STM and pluggable persistence engine support over a variety of data stores. As a result the domain
tags: scala
Mar 29 2010 10:15 AM
vote up
0
vote down

Scala Beauty – Arabic DSL

Recently I gave a Scala talk at the Egyptian Java Developer Conference, one of the demos that raised most comments was a Lisp like internal Arabic DSL in Scala. I only knew about a few papers that studied the subject and I am no expert in this area, but
 
thinkmeta
Mar 27 2010 06:05 PM
vote up
0
vote down

Scala Beauty – Fun with Logic

While playing around with Mathematica, I though about implementing a simple DSL for Boolean expressions in Scala, my use case was something like this: val μ = (2 :: 5 :: 8 :: Φ) val p1 = all of μ is even val p2 = all of μ is odd val p3 = (some of [...]
 
thinkmeta
Mar 25 2010 04:08 AM
vote up
0
vote down

Follow-up to our Dev Brunch March 2010

A follow-up to our March 2010 Dev Brunch, summarizing the talks and providing bonus material.
 
daniel.lindner
Mar 22 2010 10:14 PM
vote up
0
vote down

Rapid development with Lombok

    Being an old NetBeans lover I’ve almost started feeling depressed second time for the last 10 days. My first disappointment was Spring Roo, which is going to be supported only by Eclipse – NetBeans and IntelliJ users are
 
Vasil Remeniuk
Mar 16 2010 10:30 AM
vote up
0
vote down

Rapid development with Lambok

    Being an old NetBeans lover I’ve almost started feeling depressed second time for the last 10 days. My first disappointment was Spring Roo, which is going to be supported only by Eclipse – NetBeans and IntelliJ users are
 
Vasil Remeniuk
Mar 16 2010 12:03 AM
vote up
0
vote down

Dependency Injection as Function Currying

Dependency Injection is one of the techniques that I use regularly when I am programming in Java. It's a nice way of making an application decoupled from concrete implementations and localize object creation logic within specific bootstrapping modules.
tags: scala
Mar 01 2010 10:47 AM
vote up
0
vote down

Producing candidates for a spelling corrector

The next step to implement the Bloom Filter-based spelling corrector is to create and check hash values for candidates against the filter without actually creating candidate instances. If the filter step succeeds the candidate String instances are
 
Thomas Jung
tags: scala
Feb 17 2010 12:05 AM
vote up
0
vote down

Why I don't like ActiveRecord for Domain Model Persistence

When it comes to a rich domain modeling, I am not a big fan of the ActiveRecord model. The biggest problem that it entails is invasiveness - the persistence model invades into my domain model. And this was also my first reaction to the Lift-CouchDB
tags: scala
Feb 15 2010 10:13 AM
vote up
0
vote down

Avoid using nulls in Scala

Scala's handling of null's mixed with implicit casting is quite tricky. I learned the hard way today and it took hours to figure out what was going on. First I thought it was a bug, but then someone pointed out...
 
Ilya Sterin
tags: scala
Feb 11 2010 09:02 AM
vote up
0
vote down

Building OSGi Bundles with Scala and Gradle

There already some good blog posts about how to build OSGi bundles in Scala, among others "An OSGi Bundle… built in Scala" of Neil Bartlett and "OSGi, Maven and Scala" of Gavin Bong using pax-construct. Here is another alternative using Gradle. Gradle is
 
Michael Kober
Feb 10 2010 12:26 AM
vote up
0
vote down

Groovy++ vs. Groovy vs. Java vs. Scala - Performance Update

I've been writing about a performance comparison between Java, Scala and Groovy in this and this post, where I compared the runtimes of these languages for a straight-forward (and far from idiomatic) implementation of the quicksort algorithm. As you
 
Nick Wiedenbrueck
tags: scala
Feb 09 2010 03:44 PM
vote up
0
vote down

Implementing hash functions in functional style

The first ability needed to enable filtering with the Bloom Filter-based spell checker is to produce hash values for candidates. The basic functionality is to hash a character given a base hash value from a preceding invocation. The hashFor function
 
Thomas Jung
tags: scala
Feb 08 2010 10:50 PM
vote up
0
vote down

Scala Self-Type Annotations for Constrained Orthogonality

I talked about orthogonality in design in one of my earlier posts. We had a class Address in Scala and we saw how we can combine it with other orthogonal concerns without polluting the core abstraction. We could do this because Scala offers a host of
tags: scala
Feb 08 2010 01:22 PM