How to extend Jatha by adding new functions

The easy way

If you can figure out how to implement it in LISP, do that rather than implement it in Java. It's simpler. Put the definition in a file and load it.

Extending the Java code

Since the new function is a LISP function, you need to define it as a method on the LispValue interface (org.jatha.dynatype.LispValue) and then implement it on one or more of the implementations of LispValue, such as StandardLispSymbol or StandardLispNumber. Put a default method on StandardLispValue that returns a default value or throws an appropriate exception if the argument type(s) are not correct at runtime.

Extending the LISP interpreter

If you just want to call the function from Java, the instructions above are sufficient. However, if you want to make the function available through the LISP interpreter, you also need to do the following: