Lisp処理系をじっそうちゅ。
cons、quote、+ を実装したところ。
もすこしうまくいったらそのうちのせます。
consはこんな感じ。
public class ConsFunction implements IFunction{ @Override public Sexp eval(Cell cell, Map<String, Sexp> env) throws FunctionException{ if(cell.getCdr().length > 2){ throw new FunctionException("cons: expects 2 arguments"); } Sexp[] cdr; if(cell.getCdr()[1] instanceof Cell){ cdr = ((Cell)cell.getCdr()[1]).getSexps(); }else{ cdr = new Sexp[]{cell.getCdr()[1]}; } return new Cell(cell.getCdr()[0], cdr); } }