25.11.2014 Views

Tema Lisp - Dpto. Ciencias de la Computación e Inteligencia Artificial.

Tema Lisp - Dpto. Ciencias de la Computación e Inteligencia Artificial.

Tema Lisp - Dpto. Ciencias de la Computación e Inteligencia Artificial.

SHOW MORE
SHOW LESS

Create successful ePaper yourself

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

Funciones como argumentos <strong>de</strong> entrada (otras)<br />

* (MAPCAR FN L)<br />

(mapcar #’(<strong>la</strong>mbda (x) (* x x)) ’(1 2 3 4 5)) => (1 4 9 16 25)<br />

(mapcar #’atom ’(a (b) 3)) => (T NIL T)<br />

* (REMOVE-IF-NOT PREDICADO L), (REMOVE-IF PREDICADO L)<br />

(remove-if-not #’atom ’((a) b (c) d)) => (B C)<br />

(remove-if #’atom ’((a) b (c) d))<br />

=> ((A) (C))<br />

* (COUNT-IF PREDICADO L), (COUNT-IF-NOT PREDICADO L)<br />

(count-if #’atom ’((a) b (c) d e)) => 3<br />

(count-if-not #’atom ’((a) b (c) d e)) => 2<br />

* (FIND-IF PREDICADO L), (FIND-IF-NOT PREDICADO L)<br />

(find-if #’atom ’((a) b (c) d e))<br />

(find-if-not #’atom ’((a) b (c) d e))<br />

=> B<br />

=> (A)<br />

IA-I 2003–2004 CcIa Introducción a <strong>Lisp</strong> <strong>Lisp</strong>.55

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

Saved successfully!

Ooh no, something went wrong!