package function.builtin.cons; import function.*; import sexpression.*; @FunctionNames({ "REST", "CDR" }) public class REST extends LispFunction { private ArgumentValidator argumentValidator; public REST(String name) { this.argumentValidator = new ArgumentValidator(name); this.argumentValidator.setExactNumberOfArguments(1); this.argumentValidator.setEveryArgumentExpectedType(Cons.class); } public SExpression call(Cons argumentList) { argumentValidator.validate(argumentList); Cons argument = (Cons) argumentList.getFirst(); return argument.getRest(); } }