lisp-Interpreter

Mar 6, 2008 at 7:12 PM
Edited Mar 6, 2008 at 7:18 PM
Hi,

i tried to use the lisp interpreter build into Singularity, but whenever issue a command like lisp \trace (define X 2) or lisp (+ 2 3) the help text is printed where it states Usage: lisp flags LISPEXPRESSION.
Am I missing something here, or does the lisp code have to be in a file? By the way, is there a build in basic editor to create scripts or textfiles?


- - - - - - - -
visit codeplex.com/wisp
Coordinator
Mar 17, 2008 at 9:14 PM
per OH:
"The code for the interpreter is in %SINGULARITY_ROOT%\Libraries\ProtoLisp\Interpreter.cs. print does not look for or seem to support primatives other than:
t, nil, cond, quote, define, lambda, defun, atom, eq, car, cdr, cons, +, -, *, /

The lisp interpreter was written as a warm up project... We have not used the interpreter for anything."

...so this is your head start; get busy! please post when you have PERL running.
Coordinator
Mar 18, 2008 at 2:08 AM
until then here's something to bootstrap your curiosity

lisp '(+ 1 2)'
Setting Strings to (+ 1 2)
3

lisp '((lambda (arg) (+ arg 1)) 5)'
Setting Strings to ((lambda (arg) (+ arg 1)) 5)
6

lisp '(cons (+ 1 2) (quote (4 5 6)))'
Setting Strings to (cons (+ 1 2) (quote (4 5 6)))
(3 4 5 6)

next i created a file
notepad ...\base\Distro\Scripts\doLisp.script
with contents
lisp '(defun shouldbe () (quote (should be)))
(cons (car (shouldbe)) (cons (quote not) (cdr (shouldbe))))'

built, ran, at the prompt:
Singularity>dolisp
Setting Strings to <...yadda...>
(should not be)

i would have to check to tell you how long your program parameter can get.
the first enhnacement should be to support recursive #include?

examine ...\base\Libraries\ProtoLisp\Interpreter.cs to see the list of (only 5) primitives
"cond", "quote", "define", "lambda", "defun"
(no "list", use "quote" instead of single quote, ...)

viva http://lispers.org/