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.

desc[cdr[x];cdr[y]-desc[x;y] : machine languageThe function desc (descend) is a function of two arguments,the first of which must be a list of the atomic symbols A (for- car) and D (for- cdr). The value of - desc is the result of executingon the second argument the sequence of - car's and - cdrlsspecified by the first argument. The operation indicated bythe first element of the list of Ags and D1s is executed first.Illegal list structure is not checked for,desc[x;y] = [null[x] -* y;atom[x] -* error; eq[car[x];A] +desc[cdr[x];car[y] -+ ];T11The function pick - finds the atomic symbol, x, in the liststructure, y. The value of pick is a list of A's (for-car) andD1s (for-cdr) which give the location of x in y. This valuecould be used for example as the first argument of - desc.Example :pick[x;y] =pick[v; (((u,v)),w)l = (A,A,D,A)null[^] -) N~;equal[x;~] -* N~~;atom[~] -* NO;T -* A[[ j]; [equal[ A NO] + h[[k]; [equal[k;~~l + NO;T -* cons[~;k]]][pick[x;cdr[ylll;~~ cons[~;jlll[pick[x;car[y] 111~rop[x;y; u] : machine languageThe function prop searches the list x, for an item identicalwith y. If such an element is found, the value of - prop is therest of the list beginning immediately after the element, Otherwisethe value is u, where u is a function of no arguments.

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

Saved successfully!

Ooh no, something went wrong!