Lambda

Definition

Lambda lets you create temporary function that don't have a set name. Looks good in Jatha!

Common LISP Code

#'(lambda (x) (+ x 3))
(funcall * 5) = 8

Common LISP Output

(LAMBDA (X) (+ X 3))
8

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("#'(lambda (x) (+ x 3))");
            lisp.add("(funcall * 5)");
            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:
#'(lambda (x) (+ x 3)) = (LAMBDA (X) (+ X 3))
(funcall * 5) = 8
BUILD SUCCESSFUL (total time: 0 seconds)

Result

Whoohoo!