package org.nwapw.abacus.number;

public abstract class Function {

    public int arity;

    protected abstract Number applyInternal(Number...params);

    public Number apply(Number...params) throws IllegalArgumentException {
        if(params.length != arity)
            throw new IllegalArgumentException("Invalid number of arguments: Function takes "
                    + arity + ", " + params.length + " provided.");
        return applyInternal(params);
    }

}

@@ -70,25 +70,65 @@
    p
-ublic int arity;%0A
+rotected abstract boolean matchesParams(Number%5B%5D params);
 %0A   
@@ -170,27 +170,27 @@
 ernal(Number
-...
+%5B%5D 
 params);%0A%0A  
@@ -232,237 +232,56 @@
 ms) 
-throws IllegalArgumentException %7B%0A        if(params.length != arity)%0A            throw new IllegalArgumentException(%22Invalid number of arguments: Function takes %22%0A                    + arity + %22, %22 + params.length + %22 provided.%22)
+%7B%0A        if(!matchesParams(params)) return null
 ;%0A  

Change function to return null on error, and change arity checks.