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

Create successful ePaper yourself

Turn your PDF publications into a flip-book with our unique Google optimized e-Paper software.

push-down list is indicated by the (complement of the) compilerpublic push-down list indicator, $CPPI. This indicator is testedby the program against the last available space in the list,($ENPDL, or end of push-down list), and when there is no morespace available an error transfer to $NOPDLAnother use of storage is illustrated below by the - consstops the computation.function which sends the result of the - cons to free storage.Each time the - cons is used, a test is made of the indicator,$FREE, which gives the (complement of the) next free-storage lo-cation available. When free storage has been used up the subroutine$FROUT is used to call in the garbage collector to retrievesome storage, (see Section 6.3.)The treatment of the function g depends on whether it is de-fined by a subroutine or by an S-expression to be interpreted.If there is a subroutine for g, g will be in the form of an fnstructionstored in location G0003, so that the TSX,GOOO~,~ in the programbelow amounts to a transfer to the subroutine. If g is definedby an S-expression, then g, as stored in G0003, will have a dec-rement pointing to the S-expression.The subroutine COMPAT be-low carries out the interpretation of the expression using theAPPLY operator.Incidentally, the 1 in the line following theuse of COMPAT has been set up by the compiler to indicate thatg is a function of one argument.The <strong>LISP</strong>-SAP program is the following:FUNCTION APPLY (F, X, P ) HAS BEEN ENTERED, ARGUMENTS. .COMPILE( ( (LABEL, MAPLIST, (LAMBDA,(x, G ),(PROG, (MI, M2), (COND, ( (NULL, X) ,(RETURN,NIL))), (SETQ,MI~ CONS^ (G,x),NIL)), (sETQ,M~,M~),AI,(SETQ, X, (CDR, X) ),(COND,( (NULL, X) ,(RETURN, MI) ) ),(RPLACD, M2,(CONS, (G,x),NIL)),(~ETQ,M~, (CDR,M~)19 (G0,Al)) 1) 1)

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

Saved successfully!

Ooh no, something went wrong!