Initial revision
// // // final public class Cons extends LispObject{ LispObject carContent,cdrContent; Cons(LispObject carContent, LispObject cdrContent){ this.carContent=carContent; this.cdrContent=cdrContent; } public int getType(){ return CONS; } public LispObject car(){ return carContent; } public LispObject cdr(){ return cdrContent; } public void setCar(LispObject a){ carContent=a; } public void setCdr(LispObject a){ cdrContent=a; } public String toString(){ String ret="("; LispObject l=this; while(true){ ret+=((Cons)l).car().toString(); l=((Cons)l).cdr(); if(l.getType()!=CONS) break; ret+=" "; } if(l == Symbol.nil) return ret+")"; else return ret+" . "+l.toString()+")"; } }
ktanaka Powered by ViewCVS 1.0-dev |
ViewCVS and CVS Help |