Structures

Definition

The common Lisp structure is a way to define a data type similiar to how C or Java does structs. A structure is a Lisp object containing some number of slots, each of which can hold any Lisp data object. Generally this is an extension of some sort to CLISP, and unfortunately it did not work in either the CLISP ide nor Jatha.

Common LISP Code (expected)

(defstruct test abc def hij)
(make-test)

Common LISP Output

TEST
#s(TEST :ABC NIL :DEF NIL :HIJ NIL)

Java Code

package jathaverify;
import org.jatha.*;
import org.jatha.dynatype.*;
import java.util.*;
public class Main  {

    public Main() {
    }

    public static void main(String[] args) {
        Jatha myLisp  = new Jatha(false, false);
        myLisp.init();
        myLisp.start();

        try {
            List lisp = new ArrayList();
            lisp.add("(defstruct test abc def hij)");

            Iterator i = lisp.iterator();
            while (i.hasNext()) {
                String query = i.next().toString();
                System.out.println(query + " = " + myLisp.eval(query));
             }

        } catch (Exception e) {
            System.err.println("LISP Exception: " + e);
        }

    }
}

Java Output (Jatha)

compile:
run:
ERROR: org.jatha.compile.UndefinedFunctionException: The function "DEFSTRUCT" is undefined.
(defstruct test abc def hij) = "org.jatha.compile.UndefinedFunctionException: The function "DEFSTRUCT" is undefined."
BUILD SUCCESSFUL (total time: 0 seconds)

Result

Doh!