/* * Name: Mike Cifelli * Course: CIS 443 - Programming Languages * Assignment: Lisp Interpreter 2 */ package eval; import parser.*; /** * FUNCALL represents the FUNCALL function in Lisp. */ public class FUNCALL extends LispFunction { public SExpression call(Cons argList) { // make sure we have received at least one argument if (argList.nullp()) { Cons originalSExpr = new Cons(new Symbol("FUNCALL"), argList); throw new RuntimeException("too few arguments given to FUNCALL: " + originalSExpr); } SExpression cdr = argList.getCdr(); Cons applyArgs = new Cons(argList.getCar(), LIST.makeList(cdr)); return APPLY.apply(applyArgs); } }