public class schemecompat { /* SCHEME "COMPATIBILITY" FUNCTIONS */ static void display( Object x ) { System.out.print(x.toString()); } static void newline() { System.out.println(); } static class Pair { Object car; Object cdr; public boolean equals( Object x ) { return (x instanceof Pair) && ((Pair)x).car.equals(this.car) && ((Pair)x).cdr.equals(this.cdr); } } static class Null { } static Object empty = new Null(); static Object falseObj = new Boolean(false); static Object minusChar = new Character('-'); static Object digits[] = { new Character('0'), new Character('1'), new Character('2'), new Character('3'), new Character('4'), new Character('5'), new Character('6'), new Character('7'), new Character('8'), new Character('9') }; static Pair cons(Object a, Object d) { Pair p = new Pair(); p.car = a; p.cdr = d; return p; } static Object car(Object x) { return ((Pair)x).car; } static Object cdr(Object x) { return ((Pair)x).cdr; } static boolean isNull(Object x) { return (x instanceof Null); } static Object append( Object x, Object y ) { return (isNull(x) ? y : cons( car(x), append( cdr(x), y ))); } static Object stringToList( Object x ) { if (((String)x).length() == 0) return empty; else return cons( new Character( ((String)x).charAt(0) ), stringToList( ((String)x).substring(1) )); } }