... until the collector arrives ...

This "blog" is really just a scratchpad of mine. There is not much of general interest here. Most of the content is scribbled down "live" as I discover things I want to remember. I rarely go back to correct mistakes in older entries. You have been warned :)


Patent Trolls Beware

Like many (most?) developers, I've always thought that the software patent system is broken beyond repair. But, I didn't know whether to laugh or cry when I came across IBM's patent application 20070244837, "SYSTEM AND METHOD FOR EXTOREXTRACTING VALUE FROM A PORTFOLIO OF ASSETS". It would be "laugh" if this were to be used only defensively. But "cry" seems appropriate when one reads stories like how IBM "extracted value" from Sun.

We need shed no tears for Sun which had turned to IP trolling as a survival strategy. The attempt "extracted value" (unlike SCO), but ultimately failed to keep Sun alive. Oracle is disbanding Sun units all over the place, but apparently the IP trolling department is safe.

Should Oracle succeed, I'd love to see IBM get their patent, jump in and claim a royalty along with infringement damages. Or perhaps not -- be careful for what you wish!


Y-Combinator in Haskell

I wrote about the Y-combinator before. Recently, I tried to express the Y-combinator in Haskell, thus:

y f = fg fg
      where fg g = f (g g)
To my surprise, I got an error message (from GHC):
Occurs check: cannot construct the infinite type: t = t -> t1

To fix it, I had to introduce a helper type to break the direct cycle in the type definition:

newtype Hold a = Hold (Hold a -> (a -> a))

y f = fg (Hold fg)
  where fg hg@(Hold g) = f (g hg)

This worked. Armed with this definition, I could now implement the factorial function in terms of the Y-combinator:

f r n = if n < 2 then 1 else n * (r (n - 1))

:type y f
-- (Num t, Ord t) => t -> t

y f 10
-- 3628800



akka brings Erlang-style processes (actors) and Clojure-style STM to Scala and Java.

Blog Archive