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.
You also want an ePaper? Increase the reach of your titles
YUMPU automatically turns print PDFs into web optimized ePapers that Google loves.
Estructuras<br />
1<br />
1<br />
1<br />
Creación <strong>de</strong> estructuras con <strong>de</strong>fstruct:<br />
(DEFSTRUCT (NOMBRE (:CONSTRUCTOR FUNCION-CONSTRUCTURA)<br />
(:CONC-NAME PREFIJO-)<br />
(:PRINT-FUNCTION FUNCION-DE-ESCRITURA))<br />
CAMPO-1<br />
...<br />
CAMPO-N)<br />
Ejemplo (puntos en el p<strong>la</strong>no):<br />
(<strong>de</strong>fstruct (punto (:constructor crea-punto)<br />
(:conc-name coor<strong>de</strong>nada-)<br />
(:print-function escribe-punto)<br />
x<br />
y)<br />
Ejemplo (función <strong>de</strong> escritura):<br />
(<strong>de</strong>fun escribe-punto (punto &optional (canal t) profundidad)<br />
(format canal "Punto <strong>de</strong> abcisa ~a y or<strong>de</strong>nada ~a"<br />
(coor<strong>de</strong>nada-x punto)<br />
(coor<strong>de</strong>nada-y punto)))<br />
IA-I 2003–2004 CcIa Introducción a <strong>Lisp</strong> <strong>Lisp</strong>.45