Skip to content

Instantly share code, notes, and snippets.

@fcamel
Created November 11, 2009 04:44
Show Gist options
  • Save fcamel/231583 to your computer and use it in GitHub Desktop.
Save fcamel/231583 to your computer and use it in GitHub Desktop.
public class N {
N prev;
N(N a) {
this.prev = a;
}
N addOne(N a) {
return new N(a);
}
N add(N a, N b) {
if (b.prev == null) {
return a;
}
return add(addOne(a), b.prev);
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment