// error checking
if (parameters.size() != ((LList) tokens).size())
throw new LException("[wrong number of arguments] - expected " + parameters.size() + ", but were " + ((LList) tokens).size() + " [args = " + ((LList) tokens) + "]");
// we make a new and empty inner environment
Environment inner = new Environment(environment, name);
for (Entry<LSymbol, Container> current : closure.entrySet()) {
if(!parameters.contains(current.getKey()) && !inner.contains(current.getKey())) {
inner.put(current.getKey(), current.getValue());
}
if(closureParameters.contains(current.getKey())) {
inner.put(current.getKey(), current.getValue());
}
}
for (int i = 0; i < parameters.size(); i++) {
LSymbol key = LSymbol.get(parameters.get(i));
LObject object = ((LList) tokens).get(i);
if(!(object instanceof LOperation))
object = object.run(inner, null);
inner.put(key, object);
}
LObject result = null;
for(LObject definition : definitions) {