// TEST SYMBOLS
LispSymbol x1 = lisp.makeSymbol("Mike");
LispValue l1 = lisp.makeCons(x1, lisp.T);
LispValue l2 = lisp.makeCons(lisp.NIL, l1);
show("L2: ", l2);
LispValue l3 = lisp.makeCons(x1, lisp.NIL);
LispValue l4 = lisp.makeCons(lisp.T, l3);
show("L4: ", l4);
LispValue l5 = lisp.makeCons(x1, lisp.NIL);
LispValue l6 = lisp.makeCons(l3, l1);
show("L6: ", l6);
// TEST Numbers
LispInteger i1 = lisp.makeInteger();
LispInteger i2 = lisp.makeInteger(5);
LispInteger i3 = lisp.makeInteger(273);
LispValue l7 = lisp.makeCons(i3, lisp.makeList(i2, i1));
show("L7: ", l7);
LispReal r1 = lisp.makeReal();
LispReal r2 = lisp.makeReal(5.5);
LispReal r3 = lisp.makeReal(273.273273);
LispValue l8 = lisp.makeList(r3, r2, r1);
show("L8: ", l8);
// TEST Strings
LispString s1 = lisp.makeString("BAZ");
LispString s2 = lisp.makeString("bar");
LispString s3 = lisp.makeString("foo");
LispValue l9 = lisp.makeCons(s3,
lisp.makeCons(s2,
lisp.makeCons(s1, lisp.makeList(r3, r2, r1))));
show("L9: ", l9);
LispValue l10 = lisp.makeList(s3, s2);
show("L10: ", l10);
// Added 23 Feb 2006 (mh)
// try {
// String expr = "(* 5 B)";
// LispValue a = lisp.makeSymbol("A");
// a.set_special(true);
// a.setf_symbol_value(lisp.makeInteger(7));
// System.out.println("A = " + a.symbol_value());
//
// LispValue B = lisp.eval("B");
// LispValue globals = lisp.makeList(lisp.makeList(lisp.makeCons(lisp.makeSymbol("B"), lisp.makeInteger(7))));
// LispValue input = lisp.parse(expr);
// LispValue result = lisp.eval(input, globals);
// System.out.println(input + " = " + result);
// } catch (IOException ioe) {
// System.err.println("Exception during test ");
// }
// Test #1
System.out.println(lisp.eval("(let ((x 7)) (* 5 x)))"));
System.out.println(lisp.eval("(progn (setq x 7) (* 5 x))"));
System.out.println(lisp.eval("(setq x 7)"));
System.out.println(lisp.eval("(* 5 x)"));
// Test #2
try {
String expr = "(let ((x 7)) (* 5 x)))";
LispValue input = lisp.parse(expr);
LispValue result = lisp.eval(input);
System.out.println(input + " = " + result);
} catch (IOException ioe) {
System.err.println("Exception during test ");
}