if(term instanceof GdlConstant || term instanceof GdlVariable)
return term;
if(term instanceof GdlFunction) {
GdlFunction function = (GdlFunction) term;
//The whole point of the function
if(function.arity() == 0)
return function.getName();
List<GdlTerm> cleanedBody = new ArrayList<GdlTerm>();
for(GdlTerm functionTerm : function.getBody())
cleanedBody.add(cleanParentheses(functionTerm));
return GdlPool.getFunction(function.getName(), cleanedBody);