   Lisp Interpreter
  Hi, I just got my lisp interpreter assignment done, but I don't know what to test it with. I have cons, car, cdr, quote append, nullp, atomp, listp, integerp, mumber, reverse, +, -, *, \, and, or, not, setq, defun, cond implemented. If any of these are non-standard names, it is because thats what the assignment required. I works just fine with a simple factorial function:(defun factorial (N)(cond ((= N 1) 1)('t (* N(factorial (- N 1))))))What would really push the interpreter to its limit that takes advantage of these simple functions?   
  Tic-Tac-Toe is a good and easy way to stress your interpreter a little.   ;  Why are you quoting t? It is normally self-evaluating.   ;Quote:Original post by RoboguyWhy are you quoting t? It is normally self-evaluating.Ahh, good point and a simple change. I'm really a newbie when it comes to lisp.Tic-Tac-Toe, ekk! That does sound challenging, as well as a great place to start, thank you.Ratings++ for all.   ;  Is it imperative? Have you implemented any functional features (lambdas, higher-order functions, etc)? If so, is it a Lisp-1 or Lisp-2 (a Lisp-2 has separate namespaces for functions and variables, and to use functions as data you have to prefix them with something (in Common Lisp, it's #'), a Lisp-1 has both in the same namespace).Also. I could be wrong, but your post seems to imply that you think Lisp is a single language.  It isn't (currently, the most commonly used Lisps are Scheme and Common Lisp (Scheme is a Lisp-1, Common LIsp is a Lisp-2).  A lot of times, just "Lisp" refers to Common Lisp, though).  Just wanted to point that out.If you don't mind a fairly complicated project, a simple term-reducer might be a good test.   ;  Ahh yes Roboguy, I was having a discussion with a few classmates earlier today about Common Lisp and Scheme. Unfortunatly the assignment was rather vague and was little more than a list of functions that our interpreter was required to implement. In fact, no formal language definition was given to us. Example interpreter code was given to us from this book, but I found their K&R style C syntax to be ugly decided to write it from scratch using C++. I used the CLISP 2.35 implementation as a reference and went from there. What I have is really only a very small subset of *some* lisp-like language.   ;Quote:Original post by aaron_dsAhh yes Roboguy, I was having a discussion with a few classmates earlier today about Common Lisp and Scheme. Unfortunatly the assignment was rather vague and was little more than a list of functions that our interpreter was required to implement. In fact, no formal language definition was given to us. Example interpreter code was given to us from this book, but I found their K&R style C syntax to be ugly decided to write it from scratch using C++. I used the CLISP 2.35 implementation as a reference and went from there. What I have is really only a very small subset of *some* lisp-like language.The Lisp it seems to resemble the most is Common Lisp.  What about my other questions (particularly the functional one and the namespace one)?   ;Quote:Original post by aaron_dsfrom this book, Heh, that's the book I cut my teeth on. I didn't think anyone would actually still use this book anymore ;-);Quote:Original post by RoboguyThe Lisp it seems to resemble the most is Common Lisp.  What about my other questions (particularly the functional one and the namespace one)?I havn't implemented lambdas or higher-order functions. From what I found looking them up breifly, I can easily integrate them into my current setup.I'm using (basically) two namespaces one for functions and one for variables. I further divided these into builtin functions, user defined functions, global variables and a stack for function argument values when using user-defined functions.We were more or less told to go out and write a "Lisp Interpreter", some of the students didn't fare well. :-\   ;Quote:Original post by aaron_dsQuote:Original post by RoboguyThe Lisp it seems to resemble the most is Common Lisp.  What about my other questions (particularly the functional one and the namespace one)?I havn't implemented lambdas or higher-order functions. From what I found looking them up breifly, I can easily integrate them into my current setup.I'm using (basically) two namespaces one for functions and one for variables. I further divided these into builtin functions, user defined functions, global variables and a stack for function argument values when using user-defined functions.We were more or less told to go out and write a "Lisp Interpreter", some of the students didn't fare well. :-\I would recommend you implement them, they are very handy (along with some functions like map and fold).  Also, I'm not sure you understand completely what I mean by Lisp-1 and Lisp-2, it really only applies to languages that have higher-order functions.  Basically, in Common Lisp (a Lisp-2) to call a variable which happens to be a function, you have to prefix it with a #' and use the funcall operator:(funcall #'f arg1 arg2 ...)While in Scheme (a Lisp-1) it would look like:(f arg1 arg2)I'm personally a Lisp-1 fan.   