10.07.2015 Views

LISP I Programmer's Manual - Software Preservation Group

LISP I Programmer's Manual - Software Preservation Group

LISP I Programmer's Manual - Software Preservation Group

SHOW MORE
SHOW LESS

You also want an ePaper? Increase the reach of your titles

YUMPU automatically turns print PDFs into web optimized ePapers that Google loves.

to the value of an expression E, the V must be quoted in theThe function setq on the other hand treats its first argumentas if quoted and evaluates its second argument only.S-expression becomesThus the(SETQ,V,E)~which is entirely equivalent to the previous, and usually moreconvenient.The following is an example of a program using the programfeature. It is a version of search, (see Chapter 2).Although the entire program is in the form of a large list, forease of reading it has been spaced out below in the form of asequential program, with the location-marking atomic symbolsset out to the left, The program variable is LT.expression for this program for the APPLY operator is,(LAMBDA, (L,P,FN,u>, (PROG,(LT),(SETQ,LT,L),TEST, (GO, (COND, ( (NULLCONT, (GO, (COND, ((P,LT), (QUOTE,RETF)),STEP, (SETQ,LT, (@DR,LT)),GO, (QUOTE, TEST) ) ,RETU, (RETURN, (u) ),RETF, '(RETURN, (FN, L ) )1)The LAMBDA,LT) , (QUOTE ,RETU) ) ,(T,(QuoTE, CONT) ) ) ) ,(T,(QUOTE,STEP)))) ,In the above note that a function of no arguments, such asu, must be put in parentheses in order to be evaluated, Cf, (u)in the line starting with RETU,

Hooray! Your file is uploaded and ready to be published.

Saved successfully!

Ooh no, something went wrong!