Why Objective Caml?

The previous posts may have given the impression that I'm learning various languages for the sake of higher academic enlightenment. Actually the core reason is much simpler: I've got some performance intensive code to write, python just didn't cut it, and in the computer language shootout benchmarks OCaml consistently kicks the collective butts of all the other popular language implementations I'm familiar with, including python, scheme, perl, ruby and java.

That's not a good enough reason on its own, but from first impressions Objective Caml appears to tick enough other boxes to be a real 'primary language' contender.

Currying

I've been playing around with the ML language recently, using the OCaml implementation.

Picking up ML illustrates to me why it's useful to learn a number of different languages in order to experience various styles of programming - it's sometimes not enough that a language merely 'supports' a particular style; sometimes the language must live that style for the user to fully get it.

For example, lots of languages support 'currying' of functions by allowing the user to return anonymous closures. However ML is the first language I've used that embraces currying as the basis for implementing multi-argument functions - i.e. in ML, multi-argument functions are literally just nested single argument functions.

For example, in the following expression:


let sum = fun i j -> i + j

the type of 'sum' is:


int -> int -> int 

..meaning that 'sum' is a function that takes an integer and returns a function which takes an integer and returns an integer.

In addition OCaml's function-call syntax doesn't use brackets, which allows the call to be considered by the user as both as a multiple-arg function call or as a bunch of nested calls. E.g. in


sum 3 4

the above could be read either as 'invoke the 'sum' function with the arguments 3 and 4', or alternatively as 'invoke the 'sum' function with an argument 3, and then invoke the result of that with the argument 4'.

Amazon get into the virtual computing space

This looks really interesting! -Basically Amazon are offering pay-as-you-go computing. Each instance is equivalent to a physical server with 1.7 GHz Xeon CPU, 1.75 GB RAM, 160 GB of local disk, and 250 Mbps of connectivity. You even get root access. Prices are:

* $0.10 per instance-hour consumed (or part of an hour consumed).
* $0.20 per GB of data transferred outside of Amazon (i.e., Internet traffic).
* $0.15 per GB-Month of Amazon S3 storage used for your images (charged by Amazon S3).

I haven't spent much time looking at this, but as far as I can see you create an 'image' on a computing instance, and then use web-service APIs to dynamically use it to bring up more instances as demand dictates. Unfortunately I'm too late for the limited beta. bah.

Numenta HTM Whitepaper

This is old news but I've only just noticed that Numenta have released their whitepaper about HTM (called Hierarchical Temporal Memory - Concepts, Theory, and Terminology). Numenta is the company that Jeff Hawkins formed with Dileep and others to create products around the ideas in his 'On Intelligence' book.

In short: Hawkins believes he's got a pretty good idea of how human intelligence works, and it's actually not very complicated. Numenta is attempting to build workable models based on these ideas to sell to punters for solving various intelligence related problems.

Actually there's not much here that hasn't been covered before in his book and in the previous technical papers by Dileep and Hawkins. Also felt there was a more of a 'corporate whitepaper' feel to this document than any of the previous stuff which was a shame.

Having said that it's still well worth a read, particularly if you haven't come across the material before. The whole layman-accessibility of the HTM ideas serve as a fantastic motivator for getting into artificial intelligence, particularly for engineers working in software who have previously written off AI as a field for ivory towered professors detached from reality.

If Hawkins is even vaguely near the mark you can expect to see this AI stuff become really important very soon.

Three Management Methods

At the risk of becoming a Spolsky link blog I wanted to point people toward a recent series of articles which look at different management styles. Joel disects each with respect to managing high tech, knowledge-oriented teams.

Introduction

1) The Command and Control method

  • Shout at people

2) The Econ101 method

  • Incentivise people with rewards

3) The Identity Management Method

  • get workers to identify with the problem by telling them stuff

I found the arguments entertaining and well thought out and I'd be interested in what others with actual management experience think. Personally I know very little about management but have encountered all three methods from the receiving end and I know which I prefer.

Java cage rattling

Joel Spolski rattles the java cage a second time, illustrating that:

  • Java is really bad at functional programming
  • Functional programming is really important for utilizing massively parallel hardware

In particular I like the way Spolski uses Javascript for his examples. The conception of this language has always been a bit of an enigma to me, especially given its timing: As far as I can see the netscape people managed to sneak a pretty good language under the idiot radar by slapping the word 'java' on the front of the name and showcasing a crappy C-style 'for' looping construct to make it look a bit like java.

Then they added dynamic typing, higher order functions, closures, prototype based OO, eval...

Laptop resilience

This morning (like most mornings) I was doing a bit of last-minute-hacking in the station waiting for the tube. The carriage looked pretty empty when it arrived, and so rather than suspend the laptop I just picked it up and grabbed my bag. Unfortunately I then proceeded to trip over my bag strap and fling the laptop through the open doors into the carriage where in ricocheted off the seat-pole-thingy and skidded across the floor into the opposite doors.

The result of this maiden voyage? Well, apart from some surface damage, the laptop appears fine. Haven't done a full fsck yet but I'm not getting any errors in the syslog. The resilience of laptops never ceases to amaze me.

Lisp aesthetics (and OO message passing)

The Lisp style has been really trying my sense of aesthetic. Yesterday I got really hung up on the fact that I prefer the 'message-passing' approach to OO rather than the 'call a function and pass in the object as an arg' style. The latter just feels clumsy to me.

Then it occurred to me that lisp syntax could easily support a message passing style. E.g. I could do:


(philaccnt 'withdraw: 10)
(meaning "send the 'withdraw' message to the philaccnt object with an argument of 10).

Hmmm... just write a 'class' macro that creates a hash of lambdas and function 'make-object' that takes the class hash and returns a closure that dispatches the messages to method calls.

Could be something to this lisp build your own language malarky...