What is the "minimal" set of primitives needed for a Lisp interpreter?

Answer

Many Lisp functions can be defined in terms of other Lisp functions.
For example, CAAR can be defined in terms of CAR as (defun caar (list) (car (car list))) It is then natural to ask whether there is a "minimal" or smallest set of primitives necessary to implement the language.
There is no single "best" minimal set of primitives; it all depends on the implementation. For example, even something as basic as numbers need not be primitive, and can be represented as lists. One possible
set of primitives might include CAR, CDR, and CONS for manipulation of S-expressions, READ and PRINT for the input/output of S-expressions and APPLY and EVAL for the guts of an interpreter. But then you might want to add LAMBDA for functions, EQ for equality, COND for conditionals, SET for assignment, and DEFUN for definitions. QUOTE might come in handy as well. If you add more specialized datatypes, such as integers, floats, arrays, characters, and structures, you'll need to add primitives to construct and access each.
AWKLisp is a Lisp interpreter written in awk, available by anonymous ftp from ftp.cs.cmu.edu:/user/ai/lang/lisp/impl/awk/. It has thirteen built-in functions: CAR, CDR, CONS, EQ, ATOM, SET, EVAL, ERROR, QUOTE,COND, AND, OR, LIST.

All lisp Questions

Ask your interview questions on lisp

Write Your comment or Questions if you want the answers on lisp from lisp Experts
Name* :
Email Id* :
Mob no* :
Question
Or
Comment* :
 





Disclimer: PCDS.CO.IN not responsible for any content, information, data or any feature of website. If you are using this website then its your own responsibility to understand the content of the website

--------- Tutorials ---