On 23.01.2004, at 09:00, Jim Weirich wrote:
> If you are interested in the java version you can find it here: 
> http://www.clug.org//ml/archive/programming/1998-11/msg00014.html
> But watch out, it is more likely to make your brain explode than itch.

Ah, you're using the anonymous inner classes trick. You can even 
implement closures (with shared data) that way in Java. It's very 
verbose and also looks pretty ugly though:

public class Closure {

     public static void main (String args[]) {
		final int a[] = new int[1];
		Runnable add = new Runnable() {
			public void run() {
				a[0] += 1;
				System.out.println("I am " + a[0] + ".");
			}
		};
		Runnable sub = new Runnable() {
			public void run() {
				a[0] -= 1;
				System.out.println("I am " + a[0] + ".");
			}
		};
		add.run();
		add.run();
		sub.run();
     }
}

> I even wrote out a commented derivation of the Y-combinator.  I swear 
> I understand each individual step of the derivation, but fitting the 
> entire thing in my head at once is difficult.
>  The derivation in here: 
> http://www.clug.org//ml/archive/programming/1998-11/msg00028.html

Cool. I've done a derivation in Scheme, too, because I did not 
understand a more theoretical text on the subject. I the just 
translated the solution I found into Ruby, which was pretty easy.

I think it's important to do this step by step, at least once. Somehow 
I felt that I've just understood something very important about the 
nature of computation when I was done with it. It's different to 
explain, like some zen-like experience I figure. ;-)

lambda { |c| lambda { |f| f[f] } [ lambda { |f| c[lambda { |x| f[f][x] 
} ] }] }