17.05.2015 Views

zl:1 - FTP

zl:1 - FTP

zl:1 - FTP

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.

573 subst-if<br />

This Zetalisp function is shadowed by the Common Lisp function of the<br />

same name.<br />

For a table of related items: See the section "Functions for Modifying<br />

Lists" in Symbolics Common Lisp: Language Concepts.<br />

subst-if new predicate tree &rest args &key key Function<br />

subst-if makes a copy of tree, substituting new for every subtree or leaf of<br />

tree such that old and the subtree or leaf satisfy the test specified by predicate.<br />

It returns the modified copy of tree, and the original tree is unchanged,<br />

although it may share with parts of the result tree. For example:<br />

(setq item-list '(numbers (1.8 2 5/3) symbols (faa bar») =><br />

(NUMBERS (1.8 2 5/3) SYMBOLS (FOO BAR»<br />

(subst-if '3.1415 #'numberp item-list) =><br />

(NUMBERS (3.1415 3.1415 3.1415) SYMBOLS (FOO BAR»<br />

item-list => (NUMBERS (1.8 2 5/3) SYMBOLS (FOO BAR»<br />

The keyword is:<br />

:key<br />

If not nil, should be a function of one argument that will<br />

extract from an element the part to be tested in place of<br />

the whole element.<br />

For a table of related items: See the section "Functions for Modifying<br />

Lists" in Symbolics Common Lisp: Language Concepts.<br />

subst-if-not new predicate tree &rest args &key key Function<br />

subst-if-not makes a copy of tree, substituting new for every subtree or leaf<br />

of tree such that old and the subtree or leaf do not satisfy the test specified<br />

by predicate. It returns the modified copy of tree, and the original tree is<br />

unchanged, although it may share with parts of the result tree. For example:<br />

(setq item-list '(numbers (1.8 2 5/3) symbols (faa bar») =><br />

(NUMBERS (1.8 2 5/3) SYMBOLS (FOO BAR»<br />

I<br />

(subst-if-not '3.1415 #'numberp item-list) =><br />

(3.1415 (1.8 2 5/3) 3.1415 (3.1415 3.1415»<br />

item-list => (NUMBERS (1.8 2 5/3) SYMBOLS (FOO BAR»<br />

The keyword is:<br />

:key<br />

If not nil, should be a function of one argument that will<br />

extract from an element the part to be tested in place of<br />

the whole element.

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

Saved successfully!

Ooh no, something went wrong!