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.

As a simple first example consider the functionapplied to the listwhere no free variables need to be assigned. The argumentsf,x, and p for the apply function, written in the form of S-expressions, are,and the value of apply[f;x;p] is (A,D),Note that the p-list must be included even though it isthe NIL list,Example 2:Some care must be exercised in writing the lists x and pcorrectly. In the example,f: CARx: ( (A,B))P: ( 1where apply[f;x;p] = car[ (A,B) 1 = A,since - car is a function of one variable, the list x must bewritten as ((A,B)) where (A,B) is the single argument. Thelist,-would be wrong. Note also that the LAMBDA definition is notneeded in this example since the specification of the argumentsis clear, It would be correct but unnecessary to write

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

Saved successfully!

Ooh no, something went wrong!