Return Styles: Pseud0ch, Terminal, Valhalla, NES, Geocities, Blue Moon. Entire thread

How do you implement cudder in Java?

Name: Anonymous 2007-09-25 12:23 ID:to4XxOKg

I want a Java cdr.

Name: Anonymous 2007-09-25 13:46 ID:aUNFateC

>>3
Read SICP

public int length(Object o) {
    Cons list = (Cons) o;
    if (list == null) {
        return 0;
    } else {
        return 1 + length(list.cdr());
    }
}

Cons l = new Cons(1, new Cons(2, new Cons(3, new Cons(4, null))));
System.out.println("length is: " + length(l));

Newer Posts
Don't change these.
Name: Email:
Entire Thread Thread List