class Lispy;
Lispy encapsulates a small lisp-like interpreter that can be trivially embedded in and expanded by another program.

You would normally use it by registering the functions you wrote to expand it, then read an expression, and evaluate what the reader returned.

		Lispy.Atom* doSomethingUseful(Lispy.List* args){
			// do something useful here that a scripter should be able to access
		Lispy l = new Lispy;

		// register your extension class with the script interpreter
		// First is the name the script writer would see. Note that you should use all
		//   uppercase for these names, and dashes (-) are the preferred way of separating
		//   words in lisp like languages.
		// Second is the number of arguments expected.
		// Third is a delegate that is called when the script wants to. It must be of the signature
		//   seen above - every function must return a value.
		// Finally, an optional argument is a documentation string for the function that the user can
		//   see from the script.
		l.registerFunction("DO-SOMETHING-USEFUL", 0, &doSomethingUseful, "Documentation for the function.");

		auto result ="(DO-SOMETHING-USEFUL)"); // reads the script's text, and returns a form that
								// can be evaluated. you should store this and pass it on:
		result = l.evaluate(result); 	// actually performs the script. The return value is the result of
						// the evaluation (in this case, the return value of doSomethingUseful)
		// Repeat all you want. The lispy class maintains functions registered and user defined, and all
		// global symbols, so you can keep calling it to continue.

Adam D. Ruppe,

Jun 07, 2007


Atom * nil();
Returns the nil atom; similar to null in D.

This should be what you return if you would ever return null or false from a script function:
		Lispy.Atom* someFunction(Lispy.List* args){
			return lispy.nil;

Atom * t();
Returns the t atom, which means true.

Page generated by Ddoc.