Archives

You are currently viewing archive for June 2006
Category: tech
Posted by: sjf
Wow, four posts in and it's my first lame personal post.

Gnome are starting a program like Google's summer of code, except it is just for women. They will be hiring some female undergraduates to work on various gnome open source projects. If the project is sufficiently completed they will be paid $3000.

I was planning on applying for Google's soc because open source looks good to employers, it shows initiative and enthusiasm for coding. As well soc would let me do some decent work on open source, something I've wanted to do for a while but have never got around to.

But then I got the job in Indiana and figured I would be too busy for another simultaneous jobs (taking the lesson from last summer). However it turns out the job so far hasn't been too time consuming and, admittedly, I've spent a lot of time slacking.

There is another reason I didn't apply for soc and why I am reluctant to apply for gwsop, I feel like I should be out having a life. My big sisters always tease me, and say that I'm too much a nerd, that I should be out living the sex, drugs and rock n' roll life style. I kinda feel that way too, there's only so much time left in college and there are some things that are harder to get away with when you are a responsible bill paying adult.

It could be in the long term that gwsop would help, I mean we all want to be the uber geek *cough* I mean red hot coder. But then I figure I have the rest of my life to write code.

If anyone thinks I should do otherwise there are 3 days left to apply for gwsop.

Category: tech
Posted by: sjf
I finally got around to reading Structure and Interpretation of Computer Programs. Amazingly, it tells us that if your languages supports returning procedures then you can implement any datatype. As an example here is how you would implement lists, well pairs really, using only procedures.

(cons constructs a pair from two elements, car returns the first element of a pair, cdr returns the second element of a pair.)

(define (cons x y)
  (define (dispatch m)
    (cond ((= m 0) x)
             ((= m 1) y)
             (else (error "Argument not 0 or 1 -- CONS" m))))

(define (car z) (z 0))

(define (cdr z) (z 1))
Here is a shorter and more mind twisting version:
(define (cons x y)
  (lambda (m) (m x y)))

(define (car z)
  (z (lambda (p q) p)))

(define (cdr z)
  (z (lambda (p q) q)))
In case you don't like lispy languages here is a python version:
def cons(x, y):
    def dispatch(m):
	if m == 0:
	   return x
	elif m == 1:
	   return y
	else:
	    raise "Cons: argument not 1 or 0: %s" % m
    return dispatch

def car(z):
    return z(0)

def cdr(z):
    return z(1)
Or the shorter, scarier version:
def cons(x, y):
    return lambda m: m(x,y)

def car(z):
    return z(lambda p,q: p)

def cdr(z):
    return z(lambda p,q: q)
You can do this for numbers as well, so don't even need your language to provide an integer type. You can use Church numerals, but at point things just get silly.
Category: tech
Posted by: sjf
So I'm sure you're all wondering what I flew half way around the world to do.

Well, I'm working in Purdue University. My supervisor is a big scheme freak, so all my work will be in scheme. At the moment I'm writing benchmark programs for the Debian programming languages shootout using Stalin, which as well as being an agressive soviet dictator is also an agressively optimising scheme compiler. Allegedly it is faster than any other functional programming language implementation, so us interns are given the job of proving it. It's not expected to beat Intel cc, fortran or gcc, but should beat ocaml, mlton, haskell, etc.

When the rest of people from my group arrive I'm going to be working on some of source code repository thing, more will be explained later.

18/06: Leaving Party

Category: General
Posted by: sjf
I had a pretty cool party before I left. I think it was the nerdiest I have ever attended.
I got some really cool presents, like PlayDoh (it smells like innocence) and ethernet cross-overers.

This is the fridge before the party, there were even more beers but they didn't fit. And no, the photo isn't all blurry because I was drunk, it's because it needed a really long exposure.

Beer Fridge