Robin's Notes

Jun 26

Importance of spaces in scala function by-name declarations:

I spent some time today having syntax problems with scala function by-name function declarations. It turns out that a space after the colon is critical. In the end someone on the scala irc channel at irc.freenode.net. by the name of ‘mapreduce’ helped me out (thanks!).

This session should clarify what works and what doesn’t work:

scala> def some1 [T] (interval :int) (f :() =>T) (noContent:T) = {}   
some1: [T](int)(() => T)(T)Unit

scala> def some2 [T] (interval :int) (f :=>T) (noContent:T) = {}  
<console>:1: error: ':' expected but identifier found.
def some2 [T] (interval :int) (f :=>T) (noContent:T) = {}
^
<console>:1: error: identifier expected but eof found.
def some2 [T] (interval :int) (f :=>T) (noContent:T) = {}
^

scala> def some2 [T] (interval :int) (f : =>T) (noContent:T) = {}
some2: [T](int)(=> T)(T)Unit

scala> def some3 [T] (interval :int) (f: =>T) (noContent:T) = {}
some3: [T](int)(=> T)(T)Unit

Jun 17

How to stop scala from quoting strings in XML expressions

Jun 01

I’ve been using Apple Numbers to help a professor friend of mine with grade calculations. It turns out that if you import a sheet from Excel, it can often get into a state where the performance becomes unacceptable - despite the actual functionality appearing to be fine.

At one point, entering a new number into a sheet with a single table of around 2000 numeric cells and no formulae at all was taking more than 5 seconds.

Exporting the data to CSV and re-importing it cured this problem.

May 31

Neither Google spreadsheets nor Apple Numbers handle text at angles other than the normal horizontal. This is understandable with Google Spreadsheets since they are limited by the browser, but an odd limitation for Numbers to have.