Mis primeras funciones en Lisp, ademas de algunos libros muy buenos para iniciarse en el mundo del lenguaje de inteligencia artificial Lisp
;Hello World (defun saludo() (format t "Ingresa tu nombre : ") (setq Nombre (read)) (format t "Hello World ~A." Nombre) 'OK ) ;funcion que devuelve el valor a nivel de Byte (defun nibble (NIB) (IF (numberp NIB) (COND ((= NIB 0) '0000 ) ((= NIB 1) '0001 ) ((= NIB 2) '0010 ) ((= NIB 3) '0011 ) ((= NIB 4) '0100 ) ((= NIB 5) '0101 ) ((= NIB 6) '0110 ) ((= NIB 7) '0111 ) ((= NIB 8) '1000 ) ((= NIB 9) '1001 ) (T 'NUMERO_ES_MAS_DE_UN_DIGITO ) ) (COND ((EQUAL NIB 'A) '1010 ) ((EQUAL NIB 'B) '1011 ) ((EQUAL NIB 'C) '1100 ) ((EQUAL NIB 'D) '1101 ) ((EQUAL NIB 'E) '1110 ) ((EQUAL NIB 'F) '1111 ) (T 'DIGITO_DESCONOCIDO ) ) ) ) ;mostrar los primeros n numeros al cuadrado (defun serie-N-cuad(Lim) (DO ( (i 1 (1+ i)) ) ((= i Lim) (format t "~A.~&" (* i i)) 'OK ) (format t "~A, " (* i i)) ) )
Comentarios
Publicar un comentario